DtVreBullseyeController handles player selections of bullseye targets in VRE stations. It manages the reference to the selected bullseye entity and updates the BullseyeLocation state data whenever the entity's location changes or when a new bullseye is selected. This controller also properly handles scenario reloads and entity removal events to maintain consistent bullseye targeting.
#include <vreBullseyeController.h>
|
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0) |
| |
◆ DtVreBullseyeController() [1/3]
| makVre::DtVreBullseyeController::DtVreBullseyeController |
( |
| ) |
|
|
private |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization.
Referenced by DtVreBullseyeController(), and operator=().
◆ DtVreBullseyeController() [2/3]
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtVreBullseyeController().
◆ DtVreBullseyeController() [3/3]
| makVre::DtVreBullseyeController::DtVreBullseyeController |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc = 0, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
Constructor.
- Parameters
-
| name | The name of this component |
| owner | The local object that owns this component |
| simManager | The simulation services manager |
| desc | Component descriptor with configuration parameters |
| parentRegistry | Optional parent registry for reader/writer functionality |
Creates a new bullseye controller component with the specified parameters.
◆ ~DtVreBullseyeController()
| virtual makVre::DtVreBullseyeController::~DtVreBullseyeController |
( |
| ) |
|
|
overridevirtual |
Virtual destructor.
Cleans up resources used by the bullseye controller component, including any signal connections.
◆ operator=()
Assignment operator (not implemented)
- Returns
- Reference to this object
Assignment operator is private and not implemented to prevent assignment.
References DtVreBullseyeController().
◆ type()
| virtual const char * makVre::DtVreBullseyeController::type |
( |
| ) |
const |
|
overridevirtual |
Gets the type identifier for this component.
- Returns
- String identifying the component type (DtVreBullseyeControllerType)
Implements the DtSimComponent::type() method to return the type identifier for this component.
◆ init()
| virtual bool makVre::DtVreBullseyeController::init |
( |
| ) |
|
|
overridevirtual |
Initializes the bullseye controller.
- Returns
- True if initialization is successful, false otherwise
Registers message handlers to process vrfSetBullseyeIdMessage messages sent by pilotSimLogic. Also sets up entity event connections.
◆ creator()
| static DtSimComponent * makVre::DtVreBullseyeController::creator |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc = 0, |
|
|
DtReaderWriterRegistry * | parentRegistry = 0 ) |
|
static |
Factory method to create a new instance of this component.
- Parameters
-
| name | The name for the new component |
| owner | The local object that will own this component |
| simManager | The simulation services manager |
| desc | Optional component descriptor |
| parentRegistry | Optional parent registry for reader/writer functionality |
- Returns
- Pointer to the newly created component
Static factory method used by the component creation system to instantiate new instances of this component type.
◆ tick()
| virtual void makVre::DtVreBullseyeController::tick |
( |
| ) |
|
|
overridevirtual |
Updates the controller state each simulation frame.
Checks if VRE has just received control over the entity and, if so, sets the "BullseyeLocation" value based on the current bullseye target. This ensures proper bullseye tracking when player control changes.
◆ processSimObjectAdded()
| void makVre::DtVreBullseyeController::processSimObjectAdded |
( |
DtSimObjectReference | simObject | ) |
|
Processes simulation object added events.
- Parameters
-
| simObject | Reference to the simulation object that was added |
Handles the case where a VRF scenario is reloaded. When this happens, VRE will reset the bullseye target according to the saved bullseye ID. This ensures continuity of bullseye targeting across scenario reloads.
◆ processSimObjectToBeRemoved()
| void makVre::DtVreBullseyeController::processSimObjectToBeRemoved |
( |
DtSimObjectReference | simObject | ) |
|
Processes simulation object removal events.
- Parameters
-
| simObject | Reference to the simulation object that will be removed |
Removes all callbacks related to the bullseye object if it is the one being removed and resets the "BullseyeLocation" value to 0. This ensures proper cleanup when the current bullseye entity is removed from the simulation.
◆ handleSetBullseyeId()
Handles bullseye ID set messages from the user.
- Parameters
-
| message | Pointer to the message containing the bullseye ID information |
- Returns
- Message processing result indicating success or failure
Processes SetBullseyeIdMessage messages sent from the user interface and updates the current bullseye object based on the entity ID in the message.
◆ updateLocation()
| void makVre::DtVreBullseyeController::updateLocation |
( |
DtSimObjectReference | simObject | ) |
|
|
private |
Updates the BullseyeLocation state data with the entity's position.
- Parameters
-
| simObject | Reference to the bullseye simulation object |
Sets the "BullseyeLocation" value to be the geocentric world location of the specified DtLocalObject. This is used to track the current position of the bullseye entity for navigation and targeting purposes.
◆ setNewBullseye()
| void makVre::DtVreBullseyeController::setNewBullseye |
( |
DtSimObjectReference | simObject | ) |
|
|
private |
Sets a new bullseye target and updates its location.
- Parameters
-
| simObject | Reference to the new bullseye simulation object |
Updates the current bullseye object reference and the "BullseyeLocation" value to reflect the new bullseye entity. This method is called when the player selects a new bullseye target or when restoring a previously selected target.
◆ myBullseyeEntity
| DtRwSimObjectReference makVre::DtVreBullseyeController::myBullseyeEntity |
|
private |
Reference to the currently selected bullseye entity.
Holds a reference to the simulation object that is currently selected as the bullseye target. This reference is updated when the player selects a new bullseye entity.
◆ myIsPlayerControlled
| bool makVre::DtVreBullseyeController::myIsPlayerControlled |
|
private |
Flag tracking the entity's player-controlled state.
Saves the last known state of whether the owning entity is player-controlled. This is used to detect when player control changes, which triggers an update of the bullseye location.
◆ mySimObjectAddedConnection
| boost::signals2::scoped_connection makVre::DtVreBullseyeController::mySimObjectAddedConnection |
|
private |
Connection for simulation object added events.
Manages the connection to simulation object added events, which is used to handle scenario reloads and re-establish bullseye targeting.
◆ mySimObjectDeletedConnection
| boost::signals2::scoped_connection makVre::DtVreBullseyeController::mySimObjectDeletedConnection |
|
private |
Connection for simulation object deleted events.
Manages the connection to simulation object deleted events, which is used to handle cleanup when bullseye entities are removed from the simulation.
The documentation for this class was generated from the following file: