Esempio n. 1
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }

        Instantiate(explosion, transform.position, transform.rotation);

        if (other.tag == "Player")
        {
            if (currentLives == 0)
            {
                ;
            }
            {
                Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
                GameController.GameOver();
            }
            GameController.RemoveLife();
            currentLives -= 1;

            /*if( currentLives == 0 )
             * {
             *      //Destroy (other.gameObject);
             *      GameController.GameOver();
             * }*/
        }

        GameController.AddScore(scoreValue);
        Destroy(other.gameObject);
        Destroy(gameObject);
    }