![]() |
VR-Forces Developer's Guide
|
Simulation objects simulated by VR-Forces can track and manage arbitrary resources. Each VR-Forces simulation object has a Resource Manager, which is an instance of the class DtSimResourceManager. It is accessible through the DtLocalObject.
The Resource Manager stores resources by resource type and storage bin. It tracks all consumable resources, each of which is represented by an instance of DtSimResource. Resources are primarily ammunition and fuel, but can include anything you wish to model. Resources are identified by their SISO enumeration. In addition to the many resource types already defined by SISO, users may define their own extensions to the SISO enumerations as well. See the Enumeration Dictionary section for more details on on how enumerations are configured and used. The Resource Manager keeps track of the quanity of each resource, as well as the total amount of each resource that can be held. During initialization, resource capacity and starting values specified in any DtVrfObjectParameters are copied to the DtSimResourceManager. Resources can be assigned to storage bins.
For information about how resources are consumed, please see Modeling Resources in a System.
A sim object's DtSimResourceManager instance can only be accessed within in the sim object itself, generally from controllers and actuators. It is accessed through the DtLocalObject.
The DtSimResourceManager has methods that allow you to:
Looking up a resource will return an instance of DtSimResource. Each DtSimResource represents a single type of resource in a specific storage bin. The DtSimResource provides methods to:
The Resource Manager stores resources in storage bins. Storage bins represent the location on the sim object where the resource is stored. The same resource type can be stored in multiple storage bins. This can be useful, for instance, if you have multiple weapons of the same type that each draw from separate resource pools. When a resource is added or depleted, it is done from a specific storage bin. Each system that consumes resources can be configured with which storage bin it should draw from.
The storage bin is represented by an enumeration. This enumeration is defined in the VRF-Enums.xml file (see Enumerations Dictionary for more details). It defines several bins with a value and name. The name is used for display purposes in the GUI, but the sim primarily refers to bins by their enumerated value. The enumeration definition should look like this, but may be modified or expanded over time.
By default, VR-Forces configures all resources to use bin 0, "General". You may use the Simulation Object Editor to change the storage bin of any resource. This can be done in the Resources section on the Systems tab for the selected entity. If you do change the storage bin, you must also edit the system properties for any system that uses the resource in order to specify the location to draw from.