Ejemplo n.º 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();
        }
    }
Ejemplo n.º 2
0
 private void OnPlayerDead()
 {
     PlayerDeadEvent?.Invoke();
 }