Example #1
0
 /// <summary>
 /// Raises the provide damage event.
 /// </summary>
 /// <param name="result">Result.</param>
 void OnProvideDamage(DamageResult result)
 {
     //Logger.Log ("kind:" + result.TookDamage.kind +" attr:" + result.TookDamage.attribute + " num:" + result.TookDamage.damageNum);
     if (Pool && DamageField.Damage.HasAttr(DamageAttribute.PENETRATION) == false)
     {
         Pool.Despawn(gameObject.transform);
     }
 }
Example #2
0
        /// <summary>
        /// Takes the single damage.
        /// </summary>
        public static void TakeDamage(GameObject target, Damage damage, Vector3 contactPos)
        {
            Damage damageClone = new Damage(damage);

            // ダメージを送る.
            if (damageClone.Owner != target && target.isStatic == false && target.activeSelf == true)
            {
                DamageInfo damageInfo = new DamageInfo(damageClone, contactPos);
                target.SendMessage(Damage.OnTakeDamageEventName, damageInfo);
                DamageResult res = new DamageResult(damageInfo, target);
                if (damageClone.Owner != null)
                {
                    damageClone.Owner.SendMessage(Damage.OnProvideDamageEventName, res);
                }
            }
        }