Ejemplo n.º 1
0
 private void OnCollisionStay2D(Collision2D collision)
 {
     if (collision.gameObject.TryGetComponent(out Block block))
     {
         BlockCollided?.Invoke();
         block.Fill();
     }
 }
Ejemplo n.º 2
0
 private void OnCollisionStay2D(Collision2D collision)
 {
     if (collision.gameObject.TryGetComponent <Block>(out Block block) && _snake.TailCount != 0)
     {
         BlockCollided?.Invoke();
         block.Fill();
     }
 }
Ejemplo n.º 3
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collided)
        {
            return;
        }

        if (BlockCollided != null)
        {
            BlockCollided.Invoke(collision);
        }

        if (collision.collider.tag == "Player")
        {
            collided = true;
            Collect();
        }
        else if (collision.collider.tag == "Bottom")
        {
            collided = true;
            Miss();
        }
    }