// 进入状态 public override void Enter(object param) { totalTime = 0; skillPart = m_SkillPart; if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART) { PlayerSkillPart playerSkill = skillPart as PlayerSkillPart; if (playerSkill.AttackAnimState != null) { // playerSkill.PlaySkillAnim("Skill005", false); //收招 string aniName = playerSkill.AttackAnimState.name + "_over"; if (playerSkill.Master.GetAnimationState(aniName) != null) { playerSkill.PlaySkillAnim(aniName, false); } } else { //Engine.Utility.Log.Trace("SkillOverState.Enter {0}技能收招动作为空!", playerSkill.GetMaster().GetName()); } playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, false); if (playerSkill.IsMainPlayer()) { stNextSkill st = new stNextSkill(); IControllerSystem cs = playerSkill.GetCtrollerSys(); if (cs == null) { Log.Error("ExecuteCmd: ControllerSystem is null"); return; } if (cs.GetCombatRobot().Status == CombatRobotStatus.RUNNING) { if (playerSkill.IsCombo(playerSkill.CurSkillID)) {//挂机连击 st.curSkillID = playerSkill.CurSkillID; SkillDoubleHitDataBase db = GameTableManager.Instance.GetTableItem <SkillDoubleHitDataBase>((uint)playerSkill.CurSkillID); if (db != null) { st.nextSkillID = db.nextskillid; if (db.nextskillid == db.beginskillid) {//挂机第三招要收招 st.nextSkillID = 0; } EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_STIFFTIMEOVER, st); } } } else {//非挂机时 插入其他技能 st.nextSkillID = 0; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_STIFFTIMEOVER, st); } } } }
// 退出状态 public override void Leave() { PlayerSkillPart playerSkill = m_SkillPart as PlayerSkillPart; if (playerSkill.IsMainPlayer()) { Log.LogGroup("ZDY", " main player leave skilloverstate"); } //SkillEffect skillEffect = m_caster.EffectNode; //if(skillEffect != null) //{//此处调用stop 会影响sing技能的放置特效 此处无意义 如果以后要调用stop 可以加break函数区分stop // skillEffect.Stop(); //} playerSkill.Master.SendMessage(EntityMessage.EntityCommand_ChangeMoveSpeedFact, (object)1f); if (SkillSystem.GetClientGlobal().IsMainPlayer(playerSkill.GetMaster())) { stForbiddenJoystick info = new stForbiddenJoystick(); info.playerID = playerSkill.Master.GetUID(); info.bFobidden = false; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILL_FORBIDDENJOYSTICK, info); } }
// 进入状态 public override void Enter(object param) { Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE, OnEvent); m_skillDoubleDb = null; m_fTotalTime = 0; skillPart = m_SkillPart; // m_skillDatabase = skillPart.GetCurSkillDataBase(); if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART) { PlayerSkillPart playerSkill = skillPart as PlayerSkillPart; //m_nDoubleHitSkillId = (uint)playerSkill.NextSkillID; if (playerSkill.IsMainPlayer()) { Log.LogGroup("ZDY", "mainpalyer enter skillattackstate================"); } m_skillDatabase = GameTableManager.Instance.GetTableItem <SkillDatabase>(playerSkill.CurSkillID, 1); if (m_skillDatabase == null) { m_Statemachine.ChangeState((int)SkillState.None, null); return; } m_uDbJiangzhiTime = m_skillDatabase.wdStiffTime; playerSkill.SkillStiffTime = 0; m_skillDoubleDb = GameTableManager.Instance.GetTableItem <SkillDoubleHitDataBase>(playerSkill.CurSkillID); if (IsMainPlayer()) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_USESKILL, playerSkill.CurSkillID); } if (m_skillDatabase.dwMoveType == (uint)SkillMoveType.FastMove) { //处理位移技能 Move move = new Move(); Vector3 targePos = playerSkill.Master.GetPos(); if (playerSkill.GetSkillTarget() != null) { targePos = playerSkill.GetSkillTarget().GetPos(); Vector3 dir = targePos - playerSkill.Master.GetPos(); targePos = targePos - dir.normalized * 1f; move.m_target = targePos; // Vector3 lookat = playerSkill.GetSkillTarget().GetNode().GetTransForm().forward; } else { m_Statemachine.ChangeState((int)SkillState.None, playerSkill); Log.LogGroup("ZDY", "skilltarget is null"); return; } move.m_ignoreStand = true; if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group) { Log.LogGroup("ZDY", "冲锋 目标位置 " + targePos); } AnimationState ani = playerSkill.AttackAnimState; if (ani == null) { m_Statemachine.ChangeState((int)SkillState.None, playerSkill); Log.LogGroup("ZDY", "ani is null"); return; } move.strRunAct = ani.name; int curSpeed = playerSkill.Master.GetProp((int)WorldObjProp.MoveSpeed); uint flySpeed = m_skillDatabase.flyspeed; float speedFact = 1; if (flySpeed != 0) { speedFact = flySpeed * 1.0f / curSpeed; } Log.LogGroup("ZDY", "冲锋倍数 " + speedFact); playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, true); playerSkill.Master.SendMessage(EntityMessage.EntityCommand_ChangeMoveSpeedFact, (object)speedFact); float dis = Vector3.Distance(targePos, playerSkill.Master.GetPos()); if (dis > 1) { Log.LogGroup("ZDY", " send moveto "); playerSkill.Master.SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move); } playerSkill.gotoPos = targePos; } else { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_ChangeMoveSpeedFact, (object)1f); } if (m_skillDatabase.useSkillType == (int)UseSkillType.GuideNoSlider) { if (m_skillDatabase.dwMoveType == (int)SkillMoveType.SkillOverMove) { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_SetVisible, false); } if (m_skillDatabase.wdStiffTime == 0) {//狂扫八方的技能 playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, true); } } else if (m_skillDatabase.useSkillType == (int)UseSkillType.GuideSlider) { if (playerSkill.IsMainPlayer()) { Client.stUninterruptMagic evenparam = new Client.stUninterruptMagic(); evenparam.time = m_skillDatabase.dwGuideTime; evenparam.type = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ; evenparam.uid = SkillSystem.GetClientGlobal().MainPlayer.GetUID(); EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, evenparam); } playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, true); } // if (m_skillDatabase.dwUseMethod == (int)UseMethod.ContinueLock) { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_SetVisible, false); } INPC npc = playerSkill.Master as INPC; if (npc != null) { int masterID = npc.GetProp((int)NPCProp.Masterid); if (masterID == PlayerSkillPart.m_ClientGlobal.MainPlayer.GetID()) { /* Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLCD_BEGIN, playerSkill.CurSkillID);*/ } } } }