//触发器 public virtual void OnTriggerEnter(Collider other) { if (bAutoEnd) { return; } int groundLayer = LayerMask.NameToLayer("ground"); //碰到地面就消失 if (IsRunning && other.gameObject.layer == groundLayer) { AutoEnd(other.gameObject.transform); return; } if (m_param.disappearWhenTouchWall) { int wallLayer = LayerMask.NameToLayer("wall"); //被带走的,碰到墙壁就消失 if (other.gameObject.layer == wallLayer) { AutoEnd(other.gameObject.transform); return; } } bool bIsMonster = false; ActorObj actorBase = other.transform.root.gameObject.GetComponent <ActorObj>(); if (actorBase == null) { actorBase = other.transform.gameObject.GetComponent <ActorObj>(); bIsMonster = true; } if (actorBase == null) { //判断是否是破碎物体 if ((other.gameObject.CompareTag("broked") || other.gameObject.layer == 13) && m_param.m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER) { GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray; for (int i = 0; i < brokedObjs.Length; ++i) { if (brokedObjs[i] == null) { continue; } //伤害对象 Broked broked = brokedObjs[i].GetComponent <Broked>(); int weight = 0; //m_param.m_skillBase.m_skillDesc.weight; broked.DoBroked(m_param.m_skillBase.m_actor.thisGameObject, weight); } if (!m_param.bThroughFlag) { AutoEnd( ); } } return; } //临时判断 ActorObj castBase = m_param.castObj.GetComponent <ActorObj>(); //if (actorBase.mActorType == castBase.mActorType) //{ // return; //} if (!castBase.IsAimActorType(actorBase))//IsAimActorType(actorBase.mActorType)) { return; } if (m_param.bAttackMoreThanOnce == false) { //增加个判断,判断是不是受过此子弹技能的伤害 for (int i = 0; i < m_param.m_skillBase.m_AttackList.Count; i++) { if (actorBase.entityid == m_param.m_skillBase.m_AttackList[i].entityid) { return; } } } // m_param.m_skillBase.m_AttackList.Find(actorBase); //增加到攻击列表 m_param.m_skillBase.m_AttackList.Add(actorBase); //纠正被击表现 DamageParam damageParam = new DamageParam(); damageParam.skillID = m_param.skillID; damageParam.attackActor = castBase;// m_param.castObj; if (bIsMonster) { damageParam.behitActor = actorBase; } else { damageParam.behitActor = actorBase; } CoreEntry.gSkillMgr.OnSkillDamage(damageParam); m_baseTool = CoreEntry.gBaseTool; //是否被带走 if (m_param.bTakeAwayTarget) { bool shouldTakeAway = true; if (actorBase != null) { //boss在气绝状态下才能被带走 if (actorBase.CheckIfBossNotQiJue()) { shouldTakeAway = false; } //无敌状态不被带走 if (actorBase.IsRecoverHealth) { shouldTakeAway = false; } } if (shouldTakeAway) { SetTakeAwayTarget(damageParam, bIsMonster); } } if (!m_param.bThroughFlag) { AutoEnd( ); } }