local Base = require "Battle/Logic/Entity/State/State_Node" local State_Idle = class("State_Idle",Base) --[[ 进入该State --]] function State_Idle:StateIn(entity, skillID, animName, command) Base.StateIn(self, entity, skillID, animName, command) if entity.components.buff and entity.components.buff:CheckHasBuffState(LuaConst.SpecialBuffs.InRiding) then entity.components.anim:SetCurAnimID(LuaConst.Animation_horseIdle,LuaConst.MoveMode.ByMoveManual) local moveComp = entity.components.move -- 进入idle,以下两个值一定是0 ,但是有一些特殊的地方不能保证。故加此下限代码。 moveComp.RideSpeedRate:Reset() moveComp.HorseExpAngle:Reset() else local replaceIdelAnim = entity.components.base.CurCharacterData.IdleAnim -- 目前只有NPC 有替换idle名字的字段 if string.isNilOrEmpty(replaceIdelAnim) then entity.components.anim:SetCurAnimID(LuaConst.Animation_idle_loop,LuaConst.MoveMode.ByMoveManual) else entity.components.anim:SetCurAnimID(replaceIdelAnim,LuaConst.MoveMode.ByMoveManual) end end end function State_Idle:StateOut(entity, skillID, animName, command) Base.StateOut(self, entity, skillID, animName, command) end function State_Idle:StateUpdateNoCmd(entity) if entity._logicInitData.IsPlayer and entity.components.anim.StatePassTime >= LuaConst.ShowRideIdlePosTimer then -- idle一段时间后 if entity.components.buff:CheckHasBuffState(LuaConst.SpecialBuffs.InRiding) then return LuaConst.StateType.HorseIdlePos end end return LuaConst.StateType.None end return State_Idle