Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }



        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
        }
        if (hitPoints == 0)
        {
            Instantiate(asteroidExplosion, transform.position, transform.rotation);
            gameController.AddScore(scoreValue);
            Destroy(gameObject);
        }
        else
        {
            hitPoints = hitPoints - 1;
        }
        Destroy(other.gameObject);
    }
Example #2
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Boundary")
     {
         return;
     }
     Instantiate(explosion, transform.position, transform.rotation);
     if (other.tag == "Player")
     {
         Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
         //gameController.GameOver();
     }
     gameController.AddScore(scoreValue);
     Destroy(other.gameObject);
     Destroy(gameObject);
 }