55 lines
1.3 KiB
Lua
55 lines
1.3 KiB
Lua
|
|
require("Modules.Battle.Logic.Monster.Monster")
|
|
|
|
MonsterManager = {}
|
|
local this = MonsterManager
|
|
|
|
|
|
function MonsterManager.Init()
|
|
this.monsterList = {}
|
|
-- 初始化灵兽技能管理
|
|
if MSkillManager.isInit==false then
|
|
--LogError("初始化 ====================mskikkmanager")
|
|
MSkillManager.Init()
|
|
end
|
|
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 this.GetMonster(camp, pos)
|
|
local index = camp * 6 + pos
|
|
return this.monsterList[index]
|
|
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 |