Beispiel #1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary" || other.tag == "Enemy" || other.tag == "PowerUp" || other.tag == "Hole")
        {
            return;
        }

        if (explosion != null)
        {
            Instantiate(explosion, transform.position, transform.rotation);
        }

        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.LoseLife();
            if (gameController.Lives <= 0)
            {
                Destroy(other.gameObject);
            }
        }

        gameController.AddScore(scoreValue);

        Destroy(gameObject);
    }