Exemplo n.º 1
0
 public void Damage(int damageAmount)
 {
     health -= damageAmount;
     if (health <= 0)
     {
         gameObject.SetActive(false); //or Destroy(gameObject);
         if (destructibleComponent != null)
         {
             destructibleComponent.TriggerDrop();
         }
         return;
     }
     else
     {
         healthBar.SetValue((float)health / maxHealth);
         if (destructibleComponent != null)
         {
             destructibleComponent.ChangeState(health);   // state is health
         }
     }
     // Debug.Log(health);
 }