|
VR-Engage
2.2
|
DtEngagedState represents the application state where the user is actively controlling an entity in the simulation. It manages gameplay controls, processes relevant messages, and handles transitions between gameplay-related states such as pausing and resuming. This state is typically nested within the network connected state.
#include <engagedState.h>
Public Member Functions | |
| DtEngagedState (DtPlayerStationApp &app) | |
| virtual | ~DtEngagedState () override |
| virtual void | onEnter (const DtPlayerStationStateArgs *args) override |
| virtual void | onExit () override |
| virtual void | tick (double dt) override |
| virtual void | onExposed () override |
| virtual void | onStacked () override |
| virtual bool | isPlaying () const |
| virtual DtVreMessageResult | handleEscKey (DtVreMessage *message) |
| virtual DtVreMessageResult | handleBackButtonClicked (DtVreMessage *message) |
Public Member Functions inherited from makVre::DtPlayerStationState | |
| DtPlayerStationState (DtPlayerStationApp &app, std::string stateType) | |
| virtual | ~DtPlayerStationState () |
| DtPlayerStationState (const DtPlayerStationState &)=delete | |
| DtPlayerStationState & | operator= (const DtPlayerStationState &)=delete |
| virtual void | onEnter () |
| virtual void | onExposed (const DtPlayerStationStateArgs *args) |
| bool | active () const |
| bool | exposed () const |
| bool | exiting () const |
| bool | stacking () const |
| const std::string & | stateType () const |
| DtPlayerStationApp & | app () const |
Protected Attributes | |
| std::shared_ptr< DtPlayerStationPersistentNotification > | myPersistentNotification |
| bool | myIsPlaying |
| bool | myIsModalOpen |
| boost::signals2::connection | myEntityRemovedConnection |
| std::string | myBasePlayerEmbarkedRole |
| DtEntityIdentifier | myBasePlayerHost |
| bool | myBasePlayerIsInvisible |
| bool | myOhMySomethingHasChanged |
Protected Attributes inherited from makVre::DtPlayerStationState | |
| DtPlayerStationApp & | myApp |
| makVre::DtEngagedState::DtEngagedState | ( | DtPlayerStationApp & | app | ) |
Constructor.
| app | Reference to the player station application |
Creates a new engaged state associated with the given application.
References makVre::DtPlayerStationState::app().
|
overridevirtual |
Virtual destructor.
Ensures proper cleanup of the engaged state resources.
|
overridevirtual |
Called when the state is entered.
| args | Pointer to arguments from the previous state |
Sets up the gameplay environment, registers message handlers, and initializes the player controls. This is called when the player first enters the engaged state, typically after selecting a role.
Reimplemented from makVre::DtPlayerStationState.
Reimplemented in makVre::DtExtendedEngagedState.
|
overridevirtual |
Called when the state is exited.
Cleans up resources, disconnects from the controlled entity, and unregisters message handlers. This is called when the player leaves the engaged state, typically when disengaging from a role.
Reimplemented from makVre::DtPlayerStationState.
Reimplemented in makVre::DtExtendedEngagedState.
|
overridevirtual |
Updates the state each frame.
| dt | Time in seconds since the last update |
Handles per-frame processing for gameplay, including checking for entity status changes and updating UI elements as needed.
Reimplemented from makVre::DtPlayerStationState.
Reimplemented in makVre::DtExtendedEngagedState.
|
overridevirtual |
Called when the state becomes the topmost state again.
Restores gameplay functionality when this state is exposed after another state (like a menu) has been popped from the stack.
Reimplemented from makVre::DtPlayerStationState.
Reimplemented in makVre::DtExtendedEngagedState.
|
overridevirtual |
Called when another state is pushed on top of this one.
Temporarily disables certain gameplay functionality while this state is covered by another state on the stack, such as a pause menu.
Reimplemented from makVre::DtPlayerStationState.
Reimplemented in makVre::DtExtendedEngagedState.
|
virtual |
Checks if the simulation is currently playing.
Reports whether the simulation is currently in a playing state or if it's paused. This affects how inputs are processed.
|
virtual |
Handles escape key press messages.
| message | Pointer to the key press message |
Processes escape key presses, typically bringing up the pause menu or other options during gameplay.
|
virtual |
Handles back button click messages.
| message | Pointer to the button click message |
Processes back button clicks, typically navigating back to a previous screen or opening the pause menu during gameplay.
|
protectedvirtual |
Message handlers for role assignment.
Handles role assignment messages
| message | Pointer to the role assignment message |
Processes messages relating to assigning roles to players.
|
protectedvirtual |
Handles role unassignment messages.
| message | Pointer to the role unassignment message |
Processes messages relating to removing players from roles.
|
protectedvirtual |
Handles entity removal messages.
| message | Pointer to the entity removal message |
Processes messages relating to entities being removed from the simulation, which may require disengaging if the player's entity is removed.
|
protectedvirtual |
Handles choose role button click messages.
| message | Pointer to the button click message |
Processes clicking the choose role button, typically returning to the role selection screen from gameplay.
|
protectedvirtual |
Handles simulation state update messages.
| msg | Pointer to the simulation state message |
Processes simulation state updates, particularly tracking changes to embarkation status that might affect the player's entity.
|
protected |
Handles entity element removal signals.
| elementId | ID of the removed element |
Callback for EntityResolver signals when elements are removed. Used to detect when the player's controlled entity is removed from the simulation, which requires disengagement.
|
protectedvirtual |
Handles session play state messages.
| message | Pointer to the play state message |
Processes messages about changes to the session's play state (playing/paused), updating UI and control systems accordingly.
|
protectedvirtual |
Handles modal dialog state messages.
| message | Pointer to the modal state message |
Processes messages about modal dialogs opening or closing, adjusting gameplay controls and input handling accordingly.
|
protectedvirtual |
Handles VR-Forces simulation rewind messages.
| message | Pointer to the VrfRewindMessage |
Processes rewind requests from VR-Forces, transitioning the player back to the role selection state. The rewind message is copied and passed as state arguments to allow the choose role state to clean up and reset appropriately.
|
protectedvirtual |
Updates the state of player controls.
Enables or disables player controls based on current application state, such as whether the simulation is playing, paused, or a modal dialog is open. This ensures that controls are only active when appropriate.
|
protectedvirtual |
Updates player state after embarkation changes.
Called when embarkation status changes, such as when getting in or out of a vehicle, to update UI and control systems accordingly.
|
protectedvirtual |
Starts the player station with default settings.
Initializes the player station for the current entity and role using the default station configuration.
|
protectedvirtual |
Starts the player station with specific entity and station.
| entityId | Identifier of the entity to control |
| station | Name of the station or role to use |
Initializes the player station for a specific entity and role, typically used when switching entities or roles during gameplay.
|
protectedvirtual |
Ensures the application window has focus before engaging.
Checks if the application currently has active focus, and if not, attempts to activate and raise the main window. This is called before creating a player station to ensure that entity control logic has the correct focus state for activating mouse control.
|
protected |
Persistent notification displayed during gameplay.
|
protected |
Flag indicating whether the simulation is currently playing.
|
protected |
Flag indicating whether a modal dialog is currently open.
|
protected |
Connection to the entity removed signal.
|
protected |
Role name for embarked player.
|
protected |
Entity identifier of the host entity for embarked player.
|
protected |
Flag indicating whether the player entity is invisible.
|
protected |
Flag indicating that the entity state has changed.