local Base = require "Battle/Logic/Entity/State/State_Node" local State_Move = class("State_Move",Base) local LuaConst=LuaConst --[[ 进入该State --]] function State_Move:StateIn(entity, skillID, animName, command) Base.StateIn(self, entity, skillID, LuaConst.Animation_run_loop, command) if entity.components.buff and entity.components.buff:CheckHasBuffState(LuaConst.SpecialBuffs.InRiding) then SystemManager.AddBuff(entity, LuaConst.SpecialBuffs.HorseUpdateSelfAnim, entity) entity.components.anim:SetCurAnimID(LuaConst.Animation_horseRun,LuaConst.MoveMode.ByMoveManual) else entity.components.anim:SetCurAnimID(LuaConst.Animation_run_loop,LuaConst.MoveMode.ByMoveManual) end --奔跑动作需要慢放 local moveAnimSpeedState = entity.components.anim.RunAnimSpeedState if moveAnimSpeedState ~= 0 then SystemManager.RefreshMoveExpAnimSpeed(entity, moveAnimSpeedState == 1 and LuaConst.RunAnimSlowSpeed or 1) end end --[[ 退出该State --]] function State_Move:StateOut(entity, skillID, animName, command) Base.StateOut(self, entity, skillID, LuaConst.Animation_run_loop, command) if entity:CheckHasBuffState(LuaConst.SpecialBuffs.HorseUpdateSelfAnim) then SystemManager.DeleteBuff(entity, LuaConst.SpecialBuffs.HorseUpdateSelfAnim, nil) end --奔跑动作速度改变了,需要恢复 if entity.components.anim.RunAnimSpeedState ~= 0 then SystemManager.RefreshMoveExpAnimSpeed(entity, 1) end end --无cmd输入时 function State_Move:StateUpdateNoCmd(entity) local stateType = LuaConst.StateType.Idle if entity.components.move.isMoveStateHandled then stateType = LuaConst.StateType.None else -- 骑马的时候 ,只要马没有停住就算是move if entity.components.buff and entity.components.buff:CheckHasBuffState(LuaConst.SpecialBuffs.InRiding) then local moveComp = entity.components.move if moveComp.RideSpeedRate == FP.Const.Zero and moveComp.HorseExpAngle == FP.Const.Zero then return stateType else return LuaConst.StateType.None end elseif entity._logicInitData.IsPlayer then -- 玩家自己有跑步停 --跑停:主城没有,骑马没有 ,战斗有切需要n秒后 local animpasstime = entity.components.anim.StatePassTime if not LevelManager.IsNoBattleLevel() then if animpasstime >= LuaConst.MoveToRunStopTimer then return LuaConst.StateType.RunStop end end end end return stateType end return State_Move