Skip to content

DISGameManager

Quintin edited this page May 16, 2023 · 2 revisions

DIS Game Manager

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

Includes

Back to Top


Members

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

Back to Top


Constructors

Name Description
DISGameManager() Default constructor

Events

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.

Functions

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

Back to Top


Details

ApplicationID

int ApplicationID = 0

The Application ID of this application instance. Valid Application IDs range from 0 to 65535.

Back to Top


DISEntityParentContainer

public GameObject DISEntityParentContainer

The parent container that spawned DIS entities should be placed in.

Back to Top


DISEnumerationMapping

public DISEnumerationMappings DISEnumerationMapping

The mapping between DIS Entity IDs and corresponding entity actors.

Back to Top


EntityIDDictionary

private Dictionary<UInt64, GameObject> entityIDDictionary

Dictionary that contains all mappings between entity IDs and their associated Unity game objects.

Back to Top


EntityTypeDictionary

private Dictionary<UInt64, GameObject> entityTypeDictionary

Dictionary that contains all mappings between entity types and their associated Unity game objects.

Back to Top


ExerciseID

public int ExerciseID

The Exercise ID of the DIS sim. Valid Exercise IDs range from 0 to 255.

Back to Top


GeoreferenceScript

private GeoreferenceSystem georeferenceScript

A reference to the georeference script.

Back to Top


SiteID

public int SiteID = 0

The Site ID of this application instance. Valid Site IDs range from 0 to 65535.

Back to Top


DISGameManager

public ADISGameManager()

Default constructor.

Back to Top


e_CreateDISEntity

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.

Back to Top


e_DestroyDISEntity

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.

Back to Top


AddDISEntityToMap

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

Back to Top


Awake

private void Awake()

Awake is called when the script instance is being loaded.

https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html

Back to Top


GetAssociatedDISReceiveComponent

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

Back to Top


InitializeEntityTypeMappings

private void InitializeEntityTypeMappings()

Initializes the entityTypeDictionary dictionary.

Back to Top


RemoveDISEntityFromMap

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

Back to Top


SpawnOrGetGameObjectFromEntityStatePDU

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.

Back to Top