コード例 #1
0
 protected virtual void OnCollidedWithEnemy(Enemy i_Enemy)
 {
     if (PlayerCollided != null)
     {
         PlayerCollided.Invoke(this, i_Enemy);
     }
 }
コード例 #2
0
 protected virtual void OnCollidedWithBullet(BaseBullet i_Bullet)
 {
     if (PlayerCollided != null)
     {
         PlayerCollided.Invoke(this, i_Bullet);
     }
 }
コード例 #3
0
 private void player_Collided(BasePlayer i_Player, ICollidable2D i_CollidedWith)
 {
     if (PlayerCollided != null)
     {
         PlayerCollided.Invoke(i_Player, i_CollidedWith);
     }
 }
コード例 #4
0
        private void OnTriggerEnter(Collider other)
        {
            var element = other.gameObject.GetComponent <Element>();

            if (element != null)
            {
                switch (element.ElementType)
                {
                case ElementType.Obstacle:
                {
                    if (PlayerCollided != null)
                    {
                        PlayerCollided.Invoke();
                    }
                    Freeze();
                }
                break;

                case ElementType.Collectible:
                {
                    if (CollectibleCollected != null)
                    {
                        CollectibleCollected.Invoke(other.gameObject);
                    }
                }
                break;
                }
            }
        }
コード例 #5
0
    private void OnCollisionEnter(Collision collision)
    {
        if (!collision.collider.CompareTag("obstacle"))
        {
            return;
        }
        PlayerCollided?.Invoke(this);

        gameManager.EndGame();
    }
コード例 #6
0
 public void OnChildCollision()
 {
     PlayerCollided.Invoke();
 }