Esempio n. 1
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.gameObject.tag == "bullet")
     {
         hit1S.Play();
         Destroy(collider.gameObject);
         HP -= 0.25f;
         hpbar.setHP(HP);
         if (HP <= 0f)
         {
             loseS.Play();
             winlose.lose = true;
             Instantiate(explosion, transform.position, transform.rotation);
             Destroy(gameObject);
         }
     }
     else if (collider.gameObject.tag == "flag")
     {
         winS.Play();
         disableControls = true;
         winlose.win     = true;
     }
 }