public bool TakeDamage(float damage) { bool isDestroyed = false; //subtract damage from armor value if (damage > armor) { damage -= armor; } //if damage is lower than armor, ensure at least 1 damage is done else { damage = 1f; } //take damage curHealth -= damage; if (healthBar != null) { healthBar.AdjustHealth(-damage); } if (curHealth <= 0) { isDestroyed = true; IsDead = isDestroyed; Destroy(); } return(isDestroyed); }