![]() |
VR-Forces Developer's Guide
|
Some models need to track consumption of resources, such as fuel or munitions.
Each DtLocalObject maintains its own set of resources in a DtSimResourceManager. Each sim component can access this manager through its DtLocalObject. A component that uses resources must look up the actual resource by resource type through the DtLocalObject's resourceManager() member. For more details on the Resource Manager, please see Resource Manager.
Once you have a pointer to the resource, you can determine its current level, and modify it as needed. For example, the DtAutomotiveActuatorComponent has a useFuel() member function, which is called in its updateRepository() member function. It decrements the fuel in the entity by a given amount, as follows:
The actual types and amounts of each resource are configured in the object parameter database. (For details, please see Resource Manager.)