Exemple #1
0
        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);
            }
        }
Exemple #2
0
 public static void LogDamageEvent(DamageTaker damage, Damageable health)
 {
     Debug.Log("Damage Taken:" + health.gameObject.name +
               " takes " + damage.damage +
               " from " + damage.gameObject);
 }
Exemple #3
0
 public void DestroySelfOnHit(DamageGiver damage, Damageable health)
 {
     Destroy(health.gameObject);
 }
 private void OnDie(Damageable damageable)
 {
     Destroy(gameObject);
 }