/// <summary> /// 碰撞检测 /// </summary> protected void OnTriggerEnter(Collider other) { if (CheckUnitType(other.gameObject)) { //播放受击 var ai = GetComponent <AIBase_Monster>(); if (ai) { ai.OnHit(); } if (Parent) { MagicMgr.DealMagic(ENUM_EFFECT.DAMAGE, Parent, other.gameObject); } //子弹处理 Projectile bullet = gameObject.GetComponent <Projectile>(); if (bullet) { if (bullet.Type == ENUM_PROJECTILE.NORMAL) { Destroy(gameObject); } } } }
void DealEffect() { if (Target != null) { MagicMgr.DealMagic((ENUM_EFFECT)config.EffectType, config.EffectValue, Target); } }
void OnTriggerStay(Collider other) { Debug.Log(other.gameObject.name); if (isTrigger) { if (CheckSide(other.gameObject)) { MagicMgr.DealMagic((ENUM_EFFECT)config.EffectType, config.EffectValue, other.gameObject); } } }