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); } }
public static void LogDamageEvent(DamageGiver damage, Damageable health) { Debug.Log("Damage Given:" + health.gameObject.name + " takes " + damage.damage + " from " + damage.gameObject); }
public void DestroySelfOnHit(DamageGiver damage, Damageable health) { Destroy(health.gameObject); }