-
Notifications
You must be signed in to change notification settings - Fork 4
DISGameManager
The DIS Game Manager contains the main portion of logic for the GRILL DIS plugin. It handles the tracking of DIS Entities in the game, spawning of new ones, and delegation of DIS packets to the appropriate DIS Entity. It also provides the main interface in the Inspector panel in Unity for users to modify DIS settings in.
public class DISGameManager
: MonoBehaviour
Access | Type | Name | Description | |
---|---|---|---|---|
Public | int | ApplicationID | The Application ID of this application instance | |
Public | GameObject | DISEntityParentContainer | The parent container that spawned DIS entities should be placed in. | |
Public | DISEnumerationMappings | DISEnumerationMapping | The mapping between DIS Entity IDs and corresponding entity actors | |
Private | Dictionary<UInt64, GameObject> | entityIDDictionary | Dictionary that contains all mappings between entity IDs and their associated Unity game objects. | |
Private | Dictionary<UInt64, GameObject> | entityTypeDictionary | Dictionary that contains all mappings between entity types and their associated Unity game objects. | |
Public | int | ExerciseID | The Exercise ID of the DIS sim | |
Private | GeoreferenceSystem | georeferenceScript | A reference to the georeference script. | |
Public | int | SiteID | The Site ID of this application instance |
Name | Description |
---|---|
DISGameManager() | Default constructor |
Event Type | Event Name | Description |
---|---|---|
UnityEvent<GameObject, EntityStatePdu> | e_CreateDISEntity | Called when a new DIS entity is created in Unity. |
UnityEvent<GameObject, EDestroyCode> | e_DestroyDISEntity | Called after a DIS entity is destroyed in Unity. |
Access | Return | Name | Description | |
---|---|---|---|---|
Public | bool | AddDISEntityToMap(EntityID EntityIDToAdd, GameObject gameObjectToMapTo) | Adds a new entry to the DIS Entity map | |
Private | void | Awake() | Awake is called when the script instance is being loaded. | |
Private | DISReceiveComponent | GetAssociatedDISReceiveComponent(EntityID EntityIDIn) | Retrieves the DISReceiveComponent attached to the actor of the given ID | |
Private | void | InitializeEntityTypeMappings | Initializes the entityTypeDictionary dictionary. | |
Public | bool | RemoveDISEntityFromMap(EntityID EntityIDToRemove) | Removes the entry correlating to the given Entity ID from the DIS Entity map | |
Private | GameObject | SpawnOrGetGameObjectFromEntityStatePDU(EntityStatePdu EntityStatePDUIn) | Spawns a new Unreal actor for given Entity State PDU if mapping exists |
int ApplicationID = 0
The Application ID of this application instance. Valid Application IDs range from 0 to 65535.
public GameObject DISEntityParentContainer
The parent container that spawned DIS entities should be placed in.
public DISEnumerationMappings DISEnumerationMapping
The mapping between DIS Entity IDs and corresponding entity actors.
private Dictionary<UInt64, GameObject> entityIDDictionary
Dictionary that contains all mappings between entity IDs and their associated Unity game objects.
private Dictionary<UInt64, GameObject> entityTypeDictionary
Dictionary that contains all mappings between entity types and their associated Unity game objects.
public int ExerciseID
The Exercise ID of the DIS sim. Valid Exercise IDs range from 0 to 255.
private GeoreferenceSystem georeferenceScript
A reference to the georeference script.
public int SiteID = 0
The Site ID of this application instance. Valid Site IDs range from 0 to 65535.
public ADISGameManager()
Default constructor.
public UnityEvent<GameObject, EntityStatePdu> e_CreateDISEntity
Called when a new DIS entity is created in Unity.
Parameter | Description |
---|---|
GameObject | The Unity game object that was spawned. |
EntityStatePdu | The Entity State PDU that spawned the game object. |
public UnityEvent<GameObject, EDestroyCode> e_DestroyDISEntity
Called after a DIS entity is destroyed in Unity.
Parameter | Description |
---|---|
GameObject | The Unity game object that was destroyed. |
EDestroyCode | The cause of the Unity game object being destroyed. |
public bool AddDISEntityToMap
(
EntityID entityIDToAdd,
GameObject gameObjectToMapTo
)
Adds a new entry to the DIS Entity map.
Parameter | Description |
---|---|
entityIDToAdd | The Entity ID to key the given entity under in the map |
gameObjectToMapTo | The entity to add to the entity map |
Returns |
---|
True if the addition to the map was successful |
private void Awake()
Awake is called when the script instance is being loaded.
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html
public DISReceiveComponent GetAssociatedDISReceiveComponent
(
EntityID EntityIDIn
)
Retrieves the DISReceiveComponent attached to the actor of the given ID.
Parameter | Description |
---|---|
EntityIDIn | The entity ID of the target actor |
Returns |
---|
The DISReceiveComponent attached to the actor of the given ID |
private void InitializeEntityTypeMappings()
Initializes the entityTypeDictionary dictionary.
public bool RemoveDISEntityFromMap
(
EntityID EntityIDToRemove
)
Removes the entry correlating to the given Entity ID from the DIS Entity map.
Parameter | Description |
---|---|
EntityIDToRemove | The Entity ID of the DIS entity that needs removed from the entity map |
Returns |
---|
True if an entry was removed, false otherwise |
public GameObject SpawnOrGetGameObjectFromEntityStatePDU
(
EntityStatePdu entityStatePdu
)
Spawns a new Unreal actor for given Entity State PDU if mapping exists.
Parameter | Description |
---|---|
entityStatePdu | The entity state PDU representing the entity to spawn |
Returns |
---|
The Unity game object that was spawned or retrieved. |