local base = require("Battle/Logic/AI/Decision/Decision_Base") local Decision_IdleShow = class("Decision_IdleShow", base) local Const_DecisionIdleShow_Time = "LockIdleShowTime" --[[ 初始化 --]] function Decision_IdleShow:initialize(entity) --类型 self.Type = LuaConst.DecisionType.IdleShow --瞬时 self.IsOnce = false end function Decision_IdleShow:DecisionIn(entity, decisionData) if decisionData.IntParam2 > 0 then local aiBaseComponent = entity.components.aiBase aiBaseComponent:SetDecisionRecord(decisionData,Const_DecisionIdleShow_Time,LogicUpdateManager._clientHandleFrame) end SystemManager.SetNextState(LuaConst.StateType.Idle,entity) entity.components.anim:SetCurAnimID(decisionData.StringParam1,LuaConst.MoveMode.ByMoveManual) entity.ExpEntity:PlayAnimation(decisionData.StringParam1, 0) end --[[ 退出该Decision --]] function Decision_IdleShow:DecisionOut(entity, decisionData) SystemManager.SetNextState(LuaConst.StateType.Idle,entity) end function Decision_IdleShow:SetCommand(entity, decisionData, command) if decisionData.IntParam1 == 0 then local comp_Target = entity.components.target if comp_Target and comp_Target.Target then command.RotateDir:Reset(comp_Target.ToTargetDir) end end return command end --[[ 能否退出 --]] function Decision_IdleShow:CanExit(entity, decisionData, command) if decisionData.IntParam2 == 0 then return true elseif decisionData.IntParam2 < 0 then return false end local aiBaseComponent = entity.components.aiBase local lastInTimeFrame = aiBaseComponent:GetDecisionRecord(decisionData,Const_DecisionIdleShow_Time) if lastInTimeFrame == nil then return false end if (LogicUpdateManager._clientHandleFrame - lastInTimeFrame) >= decisionData.IntParam2 * LuaConst.LogicFrameRate then return true end return false end return Decision_IdleShow