예제 #1
0
    public void DealDamage(int damageDealt)
    {
        int clampedHealth = Mathf.Clamp(_player.Health - damageDealt, 0, _player.HealthMax);

        _player.Health = clampedHealth;
        PlayerDealtDamageEvent?.Invoke(damageDealt);
        if (_player.Health <= 0)
        {
            PlayerDeadEvent?.Invoke();
        }
    }
예제 #2
0
 private void OnPlayerDead()
 {
     PlayerDeadEvent?.Invoke();
 }