void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.tag == "EnemyBullet" || collision.transform.tag == "Enemy")
     {
         health -= 15f;
         SC.UpdateHealth(health);
     }
     if (collision.transform.tag == "Gordel")
     {
         health += 10f;
         SC.UpdateHealth(health);
     }
 }
Ejemplo n.º 2
0
 public void damage(int damage)
 {
     if (armor <= 0)
     {
         health -= damage;
         SC.UpdateHealth(health);
     }
     else
     {
         armor -= damage;
         SC.UpdateArmor(armor);
     }
     if (health < 0)
     {
         Destroy(gameObject);
     }
 }