Exemplo n.º 1
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "bonusShip")
     {
         Destroy(col.gameObject);
         ship.destroyBonusshipPlay();
     }
 }
Exemplo n.º 2
0
 //Destroy player if obstacle hits player
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "Player")
     {
         crashSound.Play();
         FindObjectOfType <GameManager>().EndGame();
         Destroy(col.gameObject);
     }
     if (col.gameObject.tag == "bonusShip")
     {
         Destroy(col.gameObject);
         ship = GameObject.FindWithTag("Player").GetComponent <spaceship>();
         ship.destroyBonusshipPlay();
     }
 }