Пример #1
0
        public void TakeDamage(DamageTaker damagerTaker)
        {
            if ((invulnrable) || currentHealth <= 0)
            {
                return;
            }

            if (!invulnrable)
            {
                currentHealth -= damagerTaker.damage;
                onHealthSet.Invoke(this);
            }

            onTakeDamage.Invoke(damagerTaker, this);

            if (currentHealth <= 0)
            {
                onDie.Invoke(this);
            }
        }
Пример #2
0
 public static void LogDamageEvent(DamageTaker damage, Damageable health)
 {
     Debug.Log("Damage Taken:" + health.gameObject.name +
               " takes " + damage.damage +
               " from " + damage.gameObject);
 }