Beispiel #1
0
        public void TakeDamage(DamageGiver damageGiver)
        {
            if ((invulnrable) || currentHealth <= 0)
            {
                return;
            }

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

            onGivenDamage.Invoke(damageGiver, this);

            if (currentHealth <= 0)
            {
                onDie.Invoke(this);
            }
        }
Beispiel #2
0
 public static void LogDamageEvent(DamageGiver damage, Damageable health)
 {
     Debug.Log("Damage Given:" + health.gameObject.name +
               " takes " + damage.damage +
               " from " + damage.gameObject);
 }
Beispiel #3
0
 public void DestroySelfOnHit(DamageGiver damage, Damageable health)
 {
     Destroy(health.gameObject);
 }