private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.TryGetComponent(out Block block)) { BlockCollided?.Invoke(); block.Fill(); } }
private void OnCollisionStay2D(Collision2D collision) { if (collision.gameObject.TryGetComponent <Block>(out Block block) && _snake.TailCount != 0) { BlockCollided?.Invoke(); block.Fill(); } }
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(); } }