Beispiel #1
0
 private void detonationInteraction(DetonationInteraction detInteraction)
 {
     //FireInteractionSubscribers
     foreach (var subscriber in DetonationInteractionSubscribers)
     {
         subscriber(detInteraction);
     }
 }
    public void CreateNewDetonation(DetonationInteraction detInteraction)
    {
        string munitionType = detInteraction.munitionType.ToString();

        GameObject reflectedPrefab = null;

        foreach (var reflectedModelPair in ReflectedModels)
        {
            if (reflectedModelPair.MunitionType == munitionType)
            {
                reflectedPrefab = reflectedModelPair.ReflectedPrefab;
                break;
            }
        }

        if (reflectedPrefab == null)
        {
            return;
        }

        GameObject currentDetonation = Instantiate(reflectedPrefab);

        RotateBulletHole bulletHole = currentDetonation.GetComponentInChildren <RotateBulletHole>();

        if (null != bulletHole)
        {
            ReflectedEntity attacker = ReflectedEntities.GetEntity(detInteraction.attacker);
            if (null != attacker)
            {
                bulletHole.AttackerPosition = attacker.transform.position;
            }
            else
            {
                foreach (PublishedEntity ent in  ExerciseConnection.LocalPublishedEntities)
                {
                    if (detInteraction.attacker == ent.MyEntityId)
                    {
                        bulletHole.AttackerPosition = ent.transform.position;
                    }
                }
            }
        }
        DetonationParticles detParticles = currentDetonation.GetComponent <DetonationParticles>();

        if (null != detParticles)
        {
            detParticles.PlayImpact(detInteraction.result);
        }
        Rigidbody detonationRb = currentDetonation.GetComponent <Rigidbody>();

        if (detonationRb != null)
        {
            detonationRb.velocity = detInteraction.linVelocity.ToVector3();
            //check if detonation has collider to elevate the detonation above the ground
            Collider detonationCollider = currentDetonation.GetComponent <Collider>();
            //collider.bounds.size.y gives the height of the collider.
            //if detonation has a rigidbody but no collider, default to 15cm above ground
            float y = null != detonationCollider ? detonationCollider.bounds.size.y + 0.02f : 0.15f;
            currentDetonation.transform.position = detInteraction.worldLocation.ToVector3() + new Vector3(0, y, 0);
        }
        else
        {
            currentDetonation.transform.position = detInteraction.worldLocation.ToVector3();
        }
    }
Beispiel #3
0
 public void SendDetonationInteraction(DetonationInteraction detInteraction)
 {
     NetSimAgent.Instance.SendDetonationInteraction(ExerciseConnectionPtr, detInteraction);
 }
Beispiel #4
0
 public extern static void SendDetonationInteraction(IntPtr exConnPtr, DetonationInteraction detInteraction);