VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtVreBullseyeController Class Reference

Detailed Description

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>

Inheritance diagram for makVre::DtVreBullseyeController:
[legend]

Public Member Functions

 DtVreBullseyeController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreBullseyeController () override
 
virtual const char * type () const override
 
virtual bool init () override
 
virtual void tick () override
 
void processSimObjectAdded (DtSimObjectReference simObject)
 
void processSimObjectToBeRemoved (DtSimObjectReference simObject)
 
- Public Member Functions inherited from makVre::DtVreSimComponent< DtSimComponent >
 DtVreSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtVreSimComponent ()
 
bool isPlayerControlled (const std::string &role="") const
 
DtString entitySystemName () const
 

Static Public Member Functions

static DtSimComponent * creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 

Protected Member Functions

virtual makVre::DtVreMessageResult handleSetBullseyeId (makVre::DtVreMessage *message)
 

Private Member Functions

 DtVreBullseyeController ()
 
 DtVreBullseyeController (const DtVreBullseyeController &orig)
 
const DtVreBullseyeControlleroperator= (const DtVreBullseyeController &orig)
 
void updateLocation (DtSimObjectReference simObject)
 
void setNewBullseye (DtSimObjectReference simObject)
 

Private Attributes

DtRwSimObjectReference myBullseyeEntity
 
bool myIsPlayerControlled
 
boost::signals2::scoped_connection mySimObjectAddedConnection
 
boost::signals2::scoped_connection mySimObjectDeletedConnection
 

Constructor & Destructor Documentation

◆ 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]

makVre::DtVreBullseyeController::DtVreBullseyeController ( const DtVreBullseyeController & orig)
private

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
nameThe name of this component
ownerThe local object that owns this component
simManagerThe simulation services manager
descComponent descriptor with configuration parameters
parentRegistryOptional 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.

Member Function Documentation

◆ operator=()

const DtVreBullseyeController & makVre::DtVreBullseyeController::operator= ( const DtVreBullseyeController & orig)
private

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
nameThe name for the new component
ownerThe local object that will own this component
simManagerThe simulation services manager
descOptional component descriptor
parentRegistryOptional 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
simObjectReference 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
simObjectReference 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()

virtual makVre::DtVreMessageResult makVre::DtVreBullseyeController::handleSetBullseyeId ( makVre::DtVreMessage * message)
protectedvirtual

Handles bullseye ID set messages from the user.

Parameters
messagePointer 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
simObjectReference 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
simObjectReference 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.

Member Data Documentation

◆ 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: