예제 #1
0
 private void acknowledgeInteraction(AcknowledgeInteraction acknowledgeInteraction)
 {
     //CreateEntityInteractionSubscribers
     foreach (var subscriber in AcknowledgeInteractionSubscribers)
     {
         subscriber(acknowledgeInteraction);
     }
 }
예제 #2
0
 public void SendAcknowledgeInteraction(AcknowledgeInteraction acknowledgeInteraction)
 {
     NetSimAgent.Instance.SendAcknowledgeInteraction(ExerciseConnectionPtr, acknowledgeInteraction);
 }
예제 #3
0
 public extern static void SendAcknowledgeInteraction(IntPtr exConnPtr, AcknowledgeInteraction acknowledgeInteraction);
    private void AcknowledgeCallback(AcknowledgeInteraction acInteraction)
    {
        if (null == InfantryPublishedEntity || acInteraction.receiverId != InfantryPublishedEntity.MyEntityId)
        {
            return;
        }

        if (acInteraction.acknowledgeFlag == NetStructs.AcknowledgeFlag.DtAckCreate)
        {
            if (!CreateEntityRequests.ContainsKey(acInteraction.requestId))
            {
                return;
            }

            CreateEntityInfo info = CreateEntityRequests[acInteraction.requestId];

            Vector3    newEntityLocation = info.Location;
            Vector3    orientation       = info.Orientation;
            EntityType entityType        = info.EntityType;
            ForceType  ForceType;

            if (info.ForceType == ForceType.DtForceOther)
            {
                ForceType = InfantryPublishedEntity.ForceType;
            }
            else
            {
                ForceType = info.ForceType;
            }

            EntityId senderId   = InfantryPublishedEntity.MyEntityId;
            EntityId recieverId = acInteraction.senderId;
            int      requestId  = acInteraction.requestId;
            XYZ      location;
            location.X = newEntityLocation.x;
            location.Y = newEntityLocation.y;
            location.Z = newEntityLocation.z;

            // x and y values of the orientation are switched in order to preserve the original rotation, don't know the reason why
            ExerciseConnection.SendCreateEntitySetData(senderId, recieverId, requestId, entityType, location, ForceType, orientation.y, orientation.x, orientation.z);

            CreateEntityRequests.Remove(requestId);

            if (OnCreateEntity != null)
            {
                OnCreateEntity(entityType);
            }
        }
        else if (acInteraction.acknowledgeFlag == NetStructs.AcknowledgeFlag.DtAckRemove)
        {
            if (!RemoveEntityRequests.ContainsKey(acInteraction.requestId))
            {
                return;
            }

            if (OnRemoveEntity != null)
            {
                OnRemoveEntity(RemoveEntityRequests[acInteraction.requestId]);
            }

            RemoveEntityRequests.Remove(acInteraction.requestId);
        }
    }