//Collisions
 void OnCollisionEnter2D(Collision2D coll)
 {
     //If the ship is hit by a laser, take one damage.
     if (coll.gameObject.tag == "Laser_Player")
     {
         TakeDamage(1);
     }
     //If the ship is damaged by any other means, die instantly.
     else if ((coll.gameObject.tag == "Player") || (coll.gameObject.tag == "Despawn") || (coll.gameObject.tag == "Nuke"))
     {
         explode.Explode();
         Destroy(gameObject);
     }
 }
Exemple #2
0
 //Function that kills the boss
 void Finaldie()
 {
     //Create explosion and destroy the boss
     explode.Explode(true, true);
     Destroy(gameObject);
 }