Ejemplo n.º 1
0
 void Awake()
 {
     if (transform.CompareTag("Player"))
     {
         OnDie = PlayerDie;
     }
     else
     {
         OnDie = Die;
     }
 }
Ejemplo n.º 2
0
        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);
        }