void Awake() { if (transform.CompareTag("Player")) { OnDie = PlayerDie; } else { OnDie = Die; } }
public void ApplyDamage(float damage) { if (CurrentHealth <= 0) { return; } CurrentHealth -= damage; ReceivedDamage?.Invoke(damage); if (CurrentHealth <= 0) { NoHealth?.Invoke(); } CurrentHealth = MathExtensions.Clamp(CurrentHealth, 0, MaxHealth); }