Exemplo n.º 1
0
 private void OnTriggerStay2D(Collider2D other)
 {
     if (IsPenguin(other))
     {
         OnTriggerStay.Invoke(currentPenguin);
     }
 }
Exemplo n.º 2
0
        public void HandlePhysicsEvents()
        {
            for (int i = 0; i < currentlyCollidingWith.Count; i++)
            {
                if (lastCollidedWith.Contains(currentlyCollidingWith[i]))
                {
                    //Collided with it last frame.
                    if (coll.isTrigger)
                    {
                        OnTriggerStay?.Invoke(currentlyCollidingWith[i]);
                    }
                    else
                    {
                        OnCollisionStay?.Invoke(new TFCollision(currentlyCollidingWith[i]));
                    }
                }
                else
                {
                    //Did not collide with last frame.
                    if (coll.isTrigger)
                    {
                        OnTriggerEnter?.Invoke(currentlyCollidingWith[i]);
                    }
                    else
                    {
                        OnCollisionEnter?.Invoke(new TFCollision(currentlyCollidingWith[i]));
                    }
                }
            }

            for (int w = 0; w < lastCollidedWith.Count; w++)
            {
                //If we've exited collision with a collider.
                if (!currentlyCollidingWith.Contains(lastCollidedWith[w]))
                {
                    if (coll.isTrigger)
                    {
                        OnTriggerExit?.Invoke(lastCollidedWith[w]);
                    }
                    else
                    {
                        OnCollisionExit?.Invoke(new TFCollision(lastCollidedWith[w]));
                    }
                }
            }
            lastCollidedWith = new List <TFCollider>(currentlyCollidingWith);
            currentlyCollidingWith.Clear();
        }
Exemplo n.º 3
0
 private void OnTriggerStay2D(Collider2D otherCollider)
 {
     OnTriggerStay?.Invoke(otherCollider);
 }
 void OnTriggerStay2D(Collider2D collider)
 {
     OnTriggerStay?.Invoke(collider);
 }
Exemplo n.º 5
0
 private void OnTriggerStay2D(Collider2D other)
 {
     OnTriggerStay?.Invoke(other, gameObject);
 }
Exemplo n.º 6
0
 private void OnTriggerStay2D(Collider2D col)
 {
     OnTriggerStay?.Invoke(col);
 }
 public void TriggerStay(ChunkLinker.Chunk chunk)
 {
     //Debug.Log("[STAY] " + chunk.Description);
     OnTriggerStay?.Invoke(chunk);
 }
Exemplo n.º 8
0
 public void FireEventStay(Rigidbody other) => OnTriggerStay?.Invoke(other);
Exemplo n.º 9
0
 public static void TriggerStay(BC_TriggerData data)
 {
     //DebugManager.LogToFile("[OnTriggerStay] " + data.collider.name + " is  colliding with " + data.myCollider.name);
     OnTriggerStay?.Invoke(data);
 }