DtVreScriptReactiveTaskController extends the script reactive task controller to provide role-based filtering of reactive tasks. It tracks which roles are currently engaged on an entity and enables or disables reactive task scripts based on role permissions defined in the component's descriptor. This allows for dynamic adjustment of entity behavior based on current role assignments.
#include <vreScriptReactiveTaskController.h>
|
| static DtSimComponent * | creator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry) |
| |
◆ DtVreScriptReactiveTaskController() [1/3]
| makVre::DtVreScriptReactiveTaskController::DtVreScriptReactiveTaskController |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc, |
|
|
DtReaderWriterRegistry * | parentRegistry ) |
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 script reactive task controller component with the specified parameters. Initializes the role-based reactive task management system.
Referenced by DtVreScriptReactiveTaskController(), and operator=().
◆ DtVreScriptReactiveTaskController() [2/3]
| makVre::DtVreScriptReactiveTaskController::DtVreScriptReactiveTaskController |
( |
| ) |
|
|
private |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization.
◆ DtVreScriptReactiveTaskController() [3/3]
◆ tick()
| virtual void makVre::DtVreScriptReactiveTaskController::tick |
( |
| ) |
|
|
overridevirtual |
Updates the controller state each simulation frame.
Overridden to check if any reactive tasks should be enabled or disabled based on what roles are currently engaged on the entity. If the engaged roles have changed since the last tick, updates the reactive tasks accordingly.
◆ creator()
| static DtSimComponent * makVre::DtVreScriptReactiveTaskController::creator |
( |
const DtString & | name, |
|
|
DtLocalObject * | owner, |
|
|
DtSimulationServices * | simManager, |
|
|
DtComponentDescriptor * | desc, |
|
|
DtReaderWriterRegistry * | parentRegistry ) |
|
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.
◆ shouldScriptBeEnabled()
| virtual bool makVre::DtVreScriptReactiveTaskController::shouldScriptBeEnabled |
( |
const DtString & | scriptName, |
|
|
const std::set< std::string > & | currentRoles ) const |
|
virtual |
Determines if a reactive task script should be enabled.
- Parameters
-
| scriptName | The name of the script to check |
| currentRoles | The set of roles currently engaged on the entity |
- Returns
- True if the script should be enabled, false otherwise
Determines whether a reactive task script should be enabled or disabled based on the allowed scripts configuration passed in through the descriptor and the currently engaged roles. A script is enabled if any of the current roles match the roles allowed for that script.
◆ updateReactiveTasks()
| virtual void makVre::DtVreScriptReactiveTaskController::updateReactiveTasks |
( |
const std::set< std::string > & | currentRoles | ) |
|
|
protectedvirtual |
Updates all reactive tasks based on current roles.
- Parameters
-
| currentRoles | The set of roles currently engaged on the entity |
Updates all the reactive tasks for the current entity by iterating through each task and calling shouldScriptBeEnabled() to determine if it should be enabled or disabled. Then applies those settings to the reactive tasks.
◆ getRolesEngagedOnEntity()
| virtual void makVre::DtVreScriptReactiveTaskController::getRolesEngagedOnEntity |
( |
std::set< std::string > & | roles | ) |
|
|
protectedvirtual |
Retrieves the set of roles currently engaged on the entity.
- Parameters
-
| roles | Output parameter to be populated with the current roles |
Populates the provided set with the names of all roles currently engaged on the entity. This information is used to determine which reactive tasks should be enabled.
◆ operator=()
Assignment operator (not implemented)
- Returns
- Reference to this object
Assignment operator is private and not implemented to prevent assignment.
References DtVreScriptReactiveTaskController().
◆ myDescriptor
Pointer to the component's descriptor.
Contains the configuration parameters for this component, including the mapping of scripts to their allowed roles.
◆ myLastTickRolesEngaged
| std::set<std::string> makVre::DtVreScriptReactiveTaskController::myLastTickRolesEngaged |
|
protected |
Set of roles that were engaged during the last tick.
Stores the set of role names that were engaged on the entity during the previous simulation frame. Used to detect changes in engaged roles.
◆ myScriptIdsWithRolesToAllow
| std::map<DtString, std::vector<std::string> > makVre::DtVreScriptReactiveTaskController::myScriptIdsWithRolesToAllow |
|
protected |
Mapping of script IDs to their allowed roles.
Maps each script ID to a vector of role names that are allowed to enable that script. A script is enabled if any of the current roles match any of the allowed roles for that script.
The documentation for this class was generated from the following file: