-
Notifications
You must be signed in to change notification settings - Fork 6
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. | |
| Private | Dictionary<EntityTypeEditor, GameObject> | entityTypeWildcardDictionary | The mapping between DIS Wildcards and corresponding entity actors | |
| 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. |
| UnityEvent<DetonationPDU | OnNoSpecificEntityDetonationPDUReceived | Called after a Detonation PDU with NO_SPECIFIC_ENTITY as its Munition ID is received. Passes the Detonation PDU as a parameter. |
| 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 = 0The Application ID of this application instance. Valid Application IDs range from 0 to 65535.
public GameObject DISEntityParentContainerThe parent container that spawned DIS entities should be placed in.
public DISEnumerationMappings DISEnumerationMappingThe mapping between DIS Entity IDs and corresponding entity actors.
private Dictionary<UInt64, GameObject> entityIDDictionaryDictionary that contains all mappings between entity IDs and their associated Unity game objects.
private Dictionary<UInt64, GameObject> entityTypeDictionaryDictionary that contains all mappings between entity types and their associated Unity game objects.
private Dictionary<EntityTypeEditor, GameObject> entityTypeDictionaryThe mapping between DIS Wildcards and corresponding entity actors
public int ExerciseIDThe Exercise ID of the DIS sim. Valid Exercise IDs range from 0 to 255.
private GeoreferenceSystem georeferenceScriptA reference to the georeference script.
public int SiteID = 0The Site ID of this application instance. Valid Site IDs range from 0 to 65535.
public ADISGameManager()Default constructor.
public UnityEvent<GameObject, EntityStatePdu> e_CreateDISEntityCalled 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_DestroyDISEntityCalled 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 UnityEvent<DetonationPdu> OnNoSpecificEntityDetonationPDUReceivedCalled after a Detonation PDU with NO_SPECIFIC_ENTITY as its Munition ID is received. Passes the Detonation PDU as a parameter.
| Parameter | Description |
|---|---|
| DetonationPdu | The Detonation PDU to be passed to the listeners. |
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. |