local Base = require("Battle/Logic/AI/Decision/Decision_Base") local Decision_SetAiRecord = class("Decision_SetAiRecord", Base) --[[ 初始化 --]] function Decision_SetAiRecord:initialize(entity) --类型 self.Type = LuaConst.DecisionType.SetAiRecord --瞬时 self.IsOnce = true end --[[ 输出指令 --]] function Decision_SetAiRecord:SetCommand(entity, decisionData, command) command.DecisionID = decisionData.ID return command end local ESetValueMode = { --SET=0、1, ADD = 2, } local EScopeType = { INNER_AI = 1, CROSS_AI = 2, } --[[ 执行 --]] function Decision_SetAiRecord:Handle(entity, decisionData, stateType, animName) local value = FP.newV1(decisionData.IntParam2) local key = decisionData.IntParam1 if decisionData.IntParam3 == ESetValueMode.ADD then value:Add(entity.components.aiBase:GetAiRecord(key) or 0) end local scope = decisionData.IntParam4 --作用域 if scope == EScopeType.CROSS_AI then--作用域为单位全局,切AI不被清空 entity.components.aiBase:SetEntityRecord(key,value) else entity.components.aiBase:SetAiRecord(key,value) --默认都设置为AI内部的,切AI会被清空 end return LuaConst.StateType.None,nil end return Decision_SetAiRecord