Exemplo n.º 1
0
 public void DealDamage(int damage)
 {
     _hp.ChangeHP(-damage);
     if (_hp.GetHP() <= 0)
     {
         Die(true);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deals damage to the base
 /// </summary>
 /// <param name="damage"></param>
 public void DealDamage(int damage)
 {
     _hp.ChangeHP(-damage);
     if (_hp.GetHP() <= 0)
     {
         FindObjectOfType <GridController>().EndGame("defeat");
     }
     _healthBar.value = (float)_hp.GetHP() / _baseHealth * 100;
 }