Ejemplo n.º 1
0
 private void Events_DetectingInitialCollision(BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable sender, BEPUphysics.BroadPhaseEntries.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair)
 {
     Health--;
     if (other.Tag is IEnemy)
     {
         ((IEnemy)other.Tag).Destroy();
     }
 }
Ejemplo n.º 2
0
        internal void Events_ContactRemoved(BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable sender, BEPUphysics.BroadPhaseEntries.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair, BEPUphysics.CollisionTests.ContactData contact)
        {
            var collision = GenerateCollision(sender, other, pair, contact);

            foreach (var m in this.gameObject.GetComponents <MonoBehaviour>())
            {
                m.OnCollisionExit(collision);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Event to detect and process collision of the spaceship with something and process mission completeness
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="other"></param>
 /// <param name="pair"></param>
 private void Events_InitialCollisionDetected(BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable sender, BEPUphysics.BroadPhaseEntries.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair)
 {
     if (pair.EntityA.Tag.ToString() == "Mothership" || pair.EntityB.Tag.ToString() == "Mothership")
     {
         goalReached = true;
         if (speed > 6)
         {
             goalReachedTooFast = true;
         }
         else
         {
             goalReachedTooFast = false;
         }
     }
 }
Ejemplo n.º 4
0
        private Collision GenerateCollision(BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable sender, BEPUphysics.BroadPhaseEntries.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair, BEPUphysics.CollisionTests.ContactData contact)
        {
            var otherEntity   = other as BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable;
            var otherCollider = otherEntity.Entity.Tag as Collider;

            var collision = new Collision()
            {
                gameObject = otherCollider.gameObject,
                contacts   = new Collision.ContactPoint[1],
            };

            collision.contacts[0] = new Collision.ContactPoint()
            {
                normal        = contact.Normal,
                point         = contact.Position,
                otherCollider = otherCollider,
                thisCollider  = this.gameObject.GetComponent <Collider>(),
            };
            return(collision);
        }
Ejemplo n.º 5
0
 private void Events_InitialCollisionDetected(BEPUphysics.BroadPhaseEntries.MobileCollidables.EntityCollidable sender, BEPUphysics.BroadPhaseEntries.Collidable other, BEPUphysics.NarrowPhaseSystems.Pairs.CollidablePairHandler pair)
 {
     System.Console.WriteLine("bump" + sender.Tag);
 }