miduo_client/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterManager.lua

55 lines
1.3 KiB
Lua
Raw Normal View History

2021-04-20 13:58:00 +08:00
2020-11-01 15:46:48 +08:00
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
2020-11-01 15:46:48 +08:00
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
2022-01-21 11:59:19 +08:00
-- 获取角色数据
function this.GetMonster(camp, pos)
local index = camp * 6 + pos
return this.monsterList[index]
end
2020-11-01 15:46:48 +08:00
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