require("Modules.Battle.Logic.Monster.Monster") MonsterManager = {} local this = MonsterManager function MonsterManager.Init() this.monsterList = {} -- 初始化灵兽技能管理 MSkillManager.Init() end function MonsterManager.AddMonster(data) local index = data.camp * 6 + data.position local monster = Monster:New() monster:Init(data) if not this.monsterList then this.monsterList = {} end this.monsterList[index] = monster BattleLogic.Event:DispatchEvent(BattleEventName.AddMonster, monster) end function MonsterManager.Update() end -- 切换时使用(已废弃) function MonsterManager.ClearEnemy() local removePos = {} for pos, obj in pairs(this.monsterList) do if obj.camp == 1 then removePos[pos] = 1 BattleLogic.Event:DispatchEvent(BattleEventName.RemoveMonster, obj) obj:Dispose() end end for pos, _ in pairs(removePos) do this.monsterList[pos] = nil end end return MonsterManager