|
VR-Engage
2.2
|
DtRoleSelectionControl provides functionality for cycling through and selecting different roles available on the current ownship entity. It tracks which roles are available (not occupied or engaged by other players), maintains state attributes for the UI to display, and handles the role switching process through input bindings or menu actions. It supports both direct-engaged roles and embark-engaged roles where a human avatar must be re-embarked in a specific slot.
#include <roleSelectionControl.h>
Classes | |
| struct | RoleListItem |
Public Member Functions | |
| DtRoleSelectionControl () | |
| virtual | ~DtRoleSelectionControl () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual bool | postInitialize () override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
| virtual void | selectRole (const std::string &roleName) |
| virtual DtVreMessageResult | handleSimState (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleMenuAction (DtVreMessage *msg) |
| virtual DtVreMessageResult | handleEntityEmbarkationInformation (DtVreMessage *msg) |
| virtual void | nextRole (double keyState) |
| virtual void | previousRole (double keyState) |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Member Functions | |
| virtual void | updateAvailableRolesAttribute () |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
Protected Attributes | |
| std::vector< RoleListItem > | myRolesList |
| unsigned int | myRoleIndex |
| std::string | myHasAvailableRolesAttributeName |
| std::string | myAvailableRolesAttributeName |
| std::string | mySelectRoleMenuAction |
| bool | myIsStackedRole |
| DtInputLogic | myInputLogic |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
| makVre::DtRoleSelectionControl::DtRoleSelectionControl | ( | ) |
Constructor for DtRoleSelectionControl.
Initializes the component with default settings
|
overridevirtual |
Virtual destructor for DtRoleSelectionControl.
|
overridevirtual |
Initializes the role selection control component.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing role selection settings |
Sets up available roles list, determines the component mode (stacked or direct), configures input bindings, and registers message handlers
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Performs post-initialization after all components are initialized.
Completes any setup that requires other components to be initialized first
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Called every frame to update the component state.
| dt | Delta time since the last frame in seconds |
For stacked roles, periodically requests embarkation information to update slot availability status
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the role selection control component.
Removes message handlers and input bindings
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the type identifier for this component.
Implements makVre::DtPlayerComponent.
|
virtual |
Switches to a specific role on the ownship entity.
| roleName | Name of the role to switch to |
For stacked roles, embarks the human player in the new role slot. For direct-engaged roles, assigns the player to the new role directly.
|
virtual |
Handles simulation state messages.
| msg | Simulation state message |
Updates role engagement status based on information in simulation state messages
|
virtual |
Handles menu action messages.
| msg | Menu action message |
Processes role selection menu actions
|
virtual |
Handles entity embarkation information messages.
| msg | Entity embarkation information message |
Updates slot occupancy status based on embarkation information
|
virtual |
Input handler for cycling to the next available role.
| keyState | Input value (1.0 for pressed, 0.0 for released) |
When triggered, finds the next non-occupied, non-engaged role and switches to it
|
virtual |
Input handler for cycling to the previous available role.
| keyState | Input value (1.0 for pressed, 0.0 for released) |
When triggered, finds the previous non-occupied, non-engaged role and switches to it
|
protectedvirtual |
Updates the available roles state attributes.
Builds a list of available roles based on occupancy and engagement status and updates the corresponding state attributes for UI display
|
protected |
List of roles available on the current entity.
|
protected |
Index of the current role in the roles list.
|
protected |
Name of the attribute indicating if there are available roles.
|
protected |
Name of the attribute containing the list of available roles.
|
protected |
Name of the menu action for selecting a role.
|
protected |
Flag indicating if this is a stacked role (embarked) versus direct-engaged.
|
protected |
Input logic for handling role selection bindings.