public void DealDamage(int damage, DamageType type) { _health -= damage; if (!Alive) { OnDestroy.SafeInvoke(this, type); Destroy(gameObject); } else { var ratio = 1f - (float)(_health - 1) / (_initialHealth - 1); _colorComponent.UpdateColor(ratio); } }