local Base = require "Battle/Logic/Entity/State/State_Node" local State_Interact = class("State_Collect",Base) local EventSystem = require('Event/EventSystem') --[[ 进入该State --]] function State_Interact:StateIn(entity, skillID, animName, command) if animName == "" then -- 策划说,没有采集动作就默认为idle animName = LuaConst.Animation_idle_loop end Base.StateIn(self, entity, skillID, animName, command) SystemManager.OffHorse(entity) -- 不能再马上采集 ,因为大部分没有做马上的采集动画 entity.components.anim:SetCurAnimID(animName,LuaConst.MoveMode.ByAnimation) end --[[ 退出该State --]] function State_Interact:StateOut(entity, skillID, animName, command) EventSystem.Dispatch(EventID.UI_Interact_Break , entity) -- 旧版本的采集代码 ↓ local interactEntity = entity.components.interact:GetCmdOpInteractEntity() if interactEntity == nil then -- 第一版的采集是没有第二版的interactEntity数据的 EventSystem.Dispatch(EventID.UI_Scene_BreakCollectItem , entity) EventSystem.Dispatch(EventID.UI_Task_BreakAuto , entity) end -- 旧版本的采集代码 ↑ end --无cmd输入时 function State_Interact:StateUpdateNoCmd(entity) --local interactEntity = entity.components.interact:GetCmdOpInteractEntity() local interactData, index = entity.components.interact:GetInteractingData() if interactData and FP.Greater(entity.components.anim.StatePassTime , interactData.InteractTime) then -- 动作结束,做交互完毕行为 SystemManager.InteractSucceed(entity, interactData, index) return LuaConst.StateType.Idle end return LuaConst.StateType.None end function State_Interact:RideHorse(entity) SystemManager.SetNextState(LuaConst.StateType.Idle, entity) end function State_Interact:OffHorse(entity) -- 不执行base,否则会回到idle end return State_Interact