public virtual void TakeDamage() { if (!canDamage) { return; } Damageable damageable = obj.GetComponent <Damageable>(); if (damageable) { OnDamageableHit.Invoke(this, damageable); damageable.TakeDamage(this); if (disableAfterHit) { DisableDamage(); } } else { OnNonDamageableHit.Invoke(this); } }
public static void LogDamageEvent(DamageTaker damage, Damageable health) { Debug.Log("Damage Taken:" + health.gameObject.name + " takes " + damage.damage + " from " + damage.gameObject); }
public void DestroySelfOnHit(DamageGiver damage, Damageable health) { Destroy(health.gameObject); }
private void OnDie(Damageable damageable) { Destroy(gameObject); }