Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerHealth player = collision.GetComponent <PlayerHealth>();

        if (player != null)
        {
            if (IsVulnerable())
            {
                camera.TriggerPlayerFocus();
                Died(player);
            }
            else
            {
                player.Hit(gameObject);
            }
        }
    }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerScore playerScore = collision.gameObject.GetComponent <PlayerScore>();

        if (playerScore != null)
        {
            playerScore.AddScore(score);
            AnimateAndDestroy();

            if (focusOnEat)
            {
                camera.TriggerPlayerFocus();
            }

            if (triggerGhostVulnerable)
            {
                foreach (GhostHealth ghost in GhostHealth.Ghosts)
                {
                    ghost.MakeVulnerable();
                }
            }
        }
    }