void CalculateDamage() { CancelInvoke("CalculateDamage"); OneCurveDamageInfo curveInfo = m_curveDamageCellDesc.curveDamageInfoList[m_curIndex]; //旋转偏移 m_transform.Rotate(Vector3.up, curveInfo.offsetAngle * Mathf.Deg2Rad); //debug #if UNITY_EDITOR GameObject efxObj = Instantiate( CoreEntry.gResLoader.LoadResource("Skill/Cube")) as GameObject; efxObj.transform.position = m_transform.position; efxObj.transform.rotation = m_transform.rotation; efxObj.name = m_curIndex.ToString(); SceneEfx efx = efxObj.AddComponent <SceneEfx>(); efx.Init(m_transform.position, 5); #endif //计算伤害monster System.Collections.Generic.List <ActorObj> actors = CoreEntry.gActorMgr.GetAllMonsterActors(); foreach (ActorObj obj in actors) { //对IOS出现怪物不动 报错的异常 进行错误处理 if (GameLogicMgr.checkValid(obj.gameObject) == false) { continue; } ActorObj actorBase = obj; //临时判断 if (actorBase.mActorType == m_skillBase.m_actor.mActorType) { continue; } if (!CoreEntry.gGameMgr.IsPvpState() && !m_skillBase.m_actor.IsAimActorType(actorBase)) { continue; } bool isSkillSuccess = BaseTool.instance.IsPointInRectangleXZ(m_transform.position, m_transform.rotation.eulerAngles, curveInfo.damageLength, curveInfo.damageWidth, obj.transform.position); //伤害对象 if (isSkillSuccess) { //纠正被击表现 DamageParam damageParam = new DamageParam(); damageParam.skillID = m_skillBase.m_skillID; damageParam.attackActor = m_skillBase.m_actor; damageParam.behitActor = actorBase; CoreEntry.gSkillMgr.OnSkillDamage(damageParam); } } //场景物件,主角破坏 if (m_skillBase.m_actor.mActorType == ActorType.AT_LOCAL_PLAYER) { GameObject[] brokedObjs = CoreEntry.gSceneMgr.brokedObjArray; for (int i = 0; i < brokedObjs.Length; ++i) { bool isSkillSuccess = BaseTool.instance.IsPointInRectangleXZ(m_transform.position, m_transform.rotation.eulerAngles, curveInfo.damageLength, curveInfo.damageWidth, brokedObjs[i].transform.position); //伤害对象 if (isSkillSuccess) { Broked broked = brokedObjs[i].GetComponent <Broked>(); int weight = 3;//m_skillBase.m_skillDesc.weight; broked.DoBroked(m_skillBase.m_actor.thisGameObject, weight); } } } if (m_curIndex < m_curveDamageCellDesc.curveDamageInfoList.Count - 1) { m_curIndex++; //设置位置 m_transform.position += m_transform.forward.normalized * curveInfo.length; Invoke("CalculateDamage", m_curveDamageCellDesc.curveDamageInfoList[m_curIndex].hitTime); } }
public override void OnEnter(ActorObj actorBase) { m_state = ACTOR_STATE.AS_DIZZY; m_actor = actorBase; m_dizzyParam = m_actor.dizzyParam; //播放动作 dizzyAction = "hit014"; //m_actor.actorCreatureDisplayDesc.DizzyAction; if (dizzyAction.Length <= 0) { //没有,就使用默认的动作 dizzyAction = m_actor.ModelConfig.Get <string>("san_walk"); } if (m_actor.IsPlayingAction(dizzyAction) == false) { m_actor.StopAll(); // 当前动作 m_actor.PlayAction(dizzyAction); } string dizzyEfx = "Effect/skill/buff/fx_bf_xuanyun"; //;m_actor.actorCreatureDisplayDesc.DizzyEfx; if (dizzyEfx.Length > 0) { if (efxObj == null) { Object tmpObj = CoreEntry.gResLoader.LoadResource(dizzyEfx); if (tmpObj != null) { efxObj = Instantiate(tmpObj) as GameObject; } SceneEfx sceneEfx = efxObj.AddComponent <SceneEfx>(); sceneEfx.Init(m_actor.transform.position, m_dizzyParam.keepTime); //设置有挂点的特效 Transform[] childTransform = efxObj.GetComponentsInChildren <Transform>(); for (int i = 0; i < childTransform.Length; i++) { Transform childTrans = childTransform[i]; EfxSetAttachPoint setAttach = childTrans.gameObject.GetComponent <EfxSetAttachPoint>(); if (setAttach == null || setAttach.m_attachPointEnum == AttachPoint.E_None) { continue; } setAttach.Init(false); Transform parent = m_actor.GetChildTransform(setAttach.m_attachPointEnum.ToString()); if (parent != null) { // 因为 top 绑定会旋转所以这里取了相对位置 childTrans.parent = m_actor.transform; childTrans.localPosition = new Vector3(0, parent.localPosition.y, 0); childTrans.localRotation = Quaternion.identity; childTrans.localScale = Vector3.one; SceneEfx sceneEfx1 = childTrans.gameObject.AddComponent <SceneEfx>(); sceneEfx1.Init(childTrans.position, m_dizzyParam.keepTime); } } } } //状态硬直,不可转换其他状态 m_isNonControl = true; CancelInvoke("AutoExitState"); Invoke("AutoExitState", m_dizzyParam.keepTime); //EventToUI.SetArg(UIEventArg.Arg1, gameObject); //EventToUI.SetArg(UIEventArg.Arg2, (float)m_dizzyParam.keepTime); //EventToUI.SendEvent("EU_ENTER_DIZZY"); }
void PrepareDownTime() { CancelInvoke("PrepareDownTime"); CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_BOSS_RISE_TO_SKY_STATED, null); //位移恢复 m_skillBase.m_actor.transform.position -= new Vector3(0, 5, 0); if (m_aimActorObject != null) { m_skillBase.m_actor.transform.position = m_aimActorObject.thisGameObject.transform.position; } //影子恢复 m_skillBase.m_actor.ShowBlobShadow(); //脚底特效 if (!string.IsNullOrEmpty(m_bossDeathFromSkyDesc.efxPrefab) && m_aimActorObject != null) { Object oj = CoreEntry.gResLoader.LoadResource(m_bossDeathFromSkyDesc.efxPrefab); if (oj != null) { GameObject efxObj = Instantiate(oj) as GameObject; SceneEfx efx = efxObj.AddComponent <SceneEfx>(); efx.Init(m_aimActorObject.thisGameObject.transform.position, 5); } } //预警贴花 if (!string.IsNullOrEmpty(m_bossDeathFromSkyDesc.efxPrefab) && m_aimActorObject != null) { if (m_WarningDecel) { Vector3 pos = m_skillBase.m_actor.transform.position; m_WarningDecel.SetPositionOnGround(pos); m_WarningDecel.ShowDecal(); } else { float fbig = 0.20f; //贴花比实际伤害范围大百分之fbig DamageCell damageCell = m_skillBase.GetComponentInChildren <DamageCell>(); //DamageCell damageCell = m_skillBase.m_actor.GetComponent<DamageCell>(); if (damageCell) { OneDamageInfo damageInfo = damageCell.GetOneDamageInfo(); if (null != damageInfo && !string.IsNullOrEmpty(m_bossDeathFromSkyDesc.efxPrefab)) { //Vector3 pos = m_skillBase.m_actor.transform.position; m_efxObj = Instantiate( CoreEntry.gResLoader.LoadResource(m_bossDeathFromSkyDesc.efxPrefab)) as GameObject; //(damageInfo.efxWarning)) as GameObject; if (m_efxObj == null) { return; } ParticleScaler ScaleComponet = m_efxObj.GetComponent <ParticleScaler>(); if (ScaleComponet == null) { ScaleComponet = m_efxObj.AddComponent <ParticleScaler>(); } // ScaleComponet.particleScale = m_actor.actorCreatureDisplayDesc.sacle ; //策划要求缩放里面的例子 //ScaleComponet.prevScale = 1.0f; m_efxObj.transform.position = new Vector3(m_skillBase.m_actor.transform.position.x, m_skillBase.m_actor.transform.position.y + 0.2f, m_skillBase.m_actor.transform.position.z); if (DamageTypeID.DTID_FUN == damageInfo.type) { m_efxObj.transform.forward = m_skillBase.m_actor.transform.forward; //m_efxObj.transform.localScale = new Vector3(1.0f, 0f, 1.0f) * damageInfo.damageNode.funDamage.radius * 2 * (1 + fbig); ScaleComponet.particleScale = damageInfo.damageNode.funDamage.radius * 2 * (1 + fbig); } else if (DamageTypeID.DTID_RECT == damageInfo.type) { m_efxObj.transform.forward = m_skillBase.m_actor.transform.forward; //m_efxObj.transform.localScale = new Vector3(1.0f, 0f, 1.0f) * damageInfo.damageNode.funDamage.radius * 2 * (1 + fbig); ScaleComponet.particleScale = damageInfo.damageNode.funDamage.radius * 2 * (1 + fbig); } //Vector3 decalPos = pos + 0.2f * m_skillBase.m_actor.m_transform.up; //实际贴花位置比原来高0.2米 防止看不到 //if (DamageTypeID.DTID_FUN == damageInfo.type) //{ // m_WarningDecel = WarningDecel.CreateSectorDecal(m_bossDeathFromSkyDesc.efxPrefab, decalPos, // damageInfo.damageNode.funDamage.radius * 2 * (1 + fbig), damageInfo.damageNode.funDamage.angle); //} //else if (DamageTypeID.DTID_RECT == damageInfo.type) //{ // m_WarningDecel = WarningDecel.CreateRectangleDecal(m_bossDeathFromSkyDesc.efxPrefab, decalPos, // damageInfo.damageNode.rectDamage.width * (1 + fbig), damageInfo.damageNode.rectDamage.length * (1 + fbig)); //} } } } } }