public float Damage(float amount) { if (amount < 0.0f) { return(Heal(amount)); } if (!invulnerable) { _health -= amount; _object.OnDamage(_health, amount); if (onDamage != null) { onDamage(); } if (healthBar != null) { healthBar.Deplete(amount / maxHealth, false); } if (_health < 0.0f) { Kill(); } } return(_health); }