Example #1
0
    void OnTriggerEnter2D(Collider2D co)
    {
        if (co.name == "pacman" && !runAway)
        {
            pacman.LoseLife();
        }

        if (co.name == "pacman" && runAway)
        {
            gameManager.PlayEatGhostSound();

            pacman.AddKillStreak();
            gameManager.AddScore(points * pacman.GetKillStreak());

            //respawn ghost
            respawn      = true;
            respawnTimer = 0;
            this.gameObject.GetComponent <SpriteRenderer>().enabled   = false;
            this.gameObject.GetComponent <CircleCollider2D>().enabled = false;
        }
    }