local Base = require("Battle/Logic/AI/Decision/Decision_Base") local Decision_RecoverOrder = class("Decision_RecoverOrder", Base) --[[ 初始化 --]] function Decision_RecoverOrder:initialize(entity) --类型 self.Type = LuaConst.DecisionType.RecoverOrder --瞬时 self.IsOnce = false end --[[ 进入该Decision --]] function Decision_RecoverOrder:DecisionIn(entity, decisionData) local bornItemID = entity._logicInitData.OriginBornItemID local monsterItem = LogicUpdateManager.MonsterItemTable[bornItemID] if monsterItem and monsterItem.Type == LuaConst.EntityLayoutType.Matrix then monsterItem.InOrder = false local patrolComponent = entity.components.patrol patrolComponent.InOrder = false if patrolComponent.IndexInMonsterItem == 1 then monsterItem.CenterPos = entity.components.move.LogicPos - patrolComponent.PosOffset end local pos = monsterItem.CenterPos + patrolComponent.PosOffset SystemManager.FindPath(entity, pos, true) end end --[[ 能否退出 --]] function Decision_RecoverOrder:CanExit(entity, decisionData, command) local bornItemID = entity._logicInitData.OriginBornItemID local monsterItem = LogicUpdateManager.MonsterItemTable[bornItemID] if monsterItem then return monsterItem.InOrder end return true end --[[ 输出指令 --]] function Decision_RecoverOrder:SetCommand(entity, decisionData, command) local patrolComponent = entity.components.patrol if not patrolComponent.InOrder then local bornItemID = entity._logicInitData.OriginBornItemID local monsterItem = LogicUpdateManager.MonsterItemTable[bornItemID] if monsterItem and monsterItem.Type == LuaConst.EntityLayoutType.Matrix then local pathComponent = entity.components.path local curPathPos = pathComponent.Path[pathComponent.CurPathPosIndex] if not curPathPos then patrolComponent.InOrder = true local allInOrder = true for _,tempEntity in pairs(monsterItem.EntityTable) do if not tempEntity.components.patrol.InOrder then allInOrder = false end end monsterItem.InOrder = allInOrder if monsterItem.InOrder then for _,tempEntity in pairs(monsterItem.EntityTable) do tempEntity.components.patrol.InOrder = false end end end end end return self:RunToPathPoint(entity, command,decisionData) end return Decision_RecoverOrder