|
VR-Engage
2.2
|
DtLightsSirensControlLogic allows toggling of emergency lights and sirens on vehicles. It maintains the state of various light types and sirens, handles menu actions for toggling them, and updates their states based on player inputs.
#include <lightsSirensControlLogic.h>
Public Member Functions | |
| DtLightsSirensControlLogic () | |
| virtual | ~DtLightsSirensControlLogic () override |
| virtual bool | initialize (makVre::DtPlayerStation *player, makVre::DtInitTable &config) override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual void | toggleSiren (const std::string &sirenName) |
| virtual void | toggleLight (const std::string &lightName) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| virtual bool | postInitialize () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Types | |
| using | LightMap = std::map<std::string, int> |
Protected Member Functions | |
| virtual makVre::DtVreMessageResult | handleMenuMessage (makVre::DtVreMessage *msg) |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
Protected Attributes | |
| LightMap | myLightMap |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
|
protected |
Type definition for mapping light names to their light type IDs.
| DtLightsSirensControlLogic::DtLightsSirensControlLogic | ( | ) |
Constructor for DtLightsSirensControlLogic.
Initializes the component with default values
|
overridevirtual |
Virtual destructor for DtLightsSirensControlLogic.
|
overridevirtual |
Initializes the lights and sirens control component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing lights and sirens settings |
Configures the available lights and sirens from the configuration table, initializes state attributes, and sets up message handlers for menu actions
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Called every frame to update lights and sirens states.
| dt | Delta time since the last frame in seconds |
Updates player attributes for all configured lights based on the entity's current appearance and light states
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the lights and sirens control component.
Removes message handlers and performs cleanup operations
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the component type identifier.
Implements makVre::DtPlayerComponent.
|
virtual |
Toggles the state of a specific siren.
| sirenName | Name of the siren to toggle |
Inverts the current state of the specified siren and updates the corresponding player attribute
|
virtual |
Toggles the state of a specific light.
| lightName | Name of the light to toggle |
Inverts the current state of the specified light, updates the corresponding player attribute, and sends a VrfSetLightStateMessage to update the visual appearance of the vehicle
|
protectedvirtual |
Handles menu action messages for lights and sirens.
| msg | The message to handle |
Processes "toggleSiren" and "toggleLights" menu actions with a parameter indicating which specific light or siren to toggle
|
protected |
Map associating light names with their corresponding light type IDs.
Maps configuration-defined light names (e.g., "headlights", "brake_lights") to their corresponding DtLightType enumeration values