Exemple #1
0
        protected virtual void OnTriggerExit2D(Collider2D c)
        {
            if (!this.enabled)
            {
                return;
            }
            CollisionTarget2D pC2D = c.gameObject.GetComponent <CollisionTarget2D>();

            if (pC2D)
            {
                CollisionObject.Disconnect(this, pC2D);
            }
        }
 protected static void Disconnect(CollisionHolder2D obj1, CollisionTarget2D obj2)
 {
     if (obj1.connection.Contains(obj2) && obj2.connection.Contains(obj1))
     {
         obj1.connection.Remove(obj2);
         obj2.connection.Remove(obj1);
         if (obj1.connection.Count == 0)
         {
             SimulationManager.Instance.RemoveCollisionObject(obj1);
         }
         if (obj2.connection.Count == 0)
         {
             SimulationManager.Instance.RemoveCollisionObject(obj2);
         }
         if (SimulationManager.Instance.IsDebugOn)
         {
             Debug.Log(obj1.name + " try to disconnect with " + obj2.name);
         }
     }
 }
 public void RemoveCollisionObject(CollisionTarget2D obj)
 {
     npProcessor.RemoveObject(obj);
 }
 public void AddCollisionObject(CollisionTarget2D obj)
 {
     npProcessor.AddObject(obj);
 }