local FuncNode_MonsterDeadCount = class("FuncNode_MonsterDeadCount") local private = {} --[[ 初始化 --]] function FuncNode_MonsterDeadCount:initialize(entity) self.LimitChildCount = 2 self.Type = LuaConst.ConditionFuncType.MonsterDeadCount end function FuncNode_MonsterDeadCount:GetMonsterDeadCountOfLevelItemByID(levelItemID) local count = 0 local levelItem = LevelItemManager.GetItemByID(levelItemID) if levelItem then if levelItem.GetDeadNumber then count = levelItem:GetDeadNumber() or 0 end else logging.error(LTAG.ERROR, "HYW : 找不到指定的关卡元素!! 元素ID :", levelItemID, " @FuncNode_MonsterDeadCount:GetMonsterDeadCountOfLevelItemByID") end return count end --[[ 执行 --]] function FuncNode_MonsterDeadCount:Run(conditionDataNode, entity, missile) local type = conditionDataNode.FirstNode:Run(entity, missile) local idParam = FP.tonumberV1(conditionDataNode.SecondNode:Run(entity, missile)) local count = 0 if type == FP.Const.One then count = LevelManager.CurLevelFunc:GetMonsterDeadCount(idParam) elseif type == FP.Const.Two then count = self:GetMonsterDeadCountOfLevelItemByID(idParam) elseif type == FP.Const.Three then local levelItemIDList = LevelItemManager.GetItemIDListByGroup(idParam, LuaConst.LevelItemType.Monster) if levelItemIDList then for i,levelItemID in ipairs(levelItemIDList) do count = count + self:GetMonsterDeadCountOfLevelItemByID(levelItemID) end end end return FP.newV1(count) end return FuncNode_MonsterDeadCount