public void Damage(float damage) { hp -= (int)damage; DamageText.ShowDamageText(gameObject, damage); if (hp <= 0) { Destroy(gameObject); } }
public void Damage(float damage) { int damageRounded = (Mathf.FloorToInt(damage)); DamageText.ShowDamageText(gameObject, damageRounded); integrity -= damageRounded; if (integrity <= 0) { Destroy(gameObject); } else { SetMaterialForDurability(); } }