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