using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Adon.Game.Manager { /// /// 游戏对象管理器 /// public class ObjectManagerAdon : MonoBehaviour { public static HeroPlayerController Hero; /// /// 已激活英雄列表 /// private static List m_Heros = new List(); /// /// 怪物列表 /// private static List m_Monsters = new List(); /// /// 全部已激活对象 /// private static Dictionary m_Objects = new Dictionary(); /// /// 添加英雄对象 /// /// /// public static void AddHeroObject(string name, GameObject obj) { m_Heros.Remove(obj); m_Heros.Add(obj); m_Objects.Remove(name); m_Objects.Add(name, obj); Hero = obj.GetComponent(); } /// /// 添加怪物对象 /// /// /// public static void AddMobObject(string name, GameObject obj) { m_Monsters.Remove(obj); m_Monsters.Add(obj); m_Objects.Remove(name); m_Objects.Add(name, obj); } /// /// 回收怪物 /// /// /// /// public static void RemoveMonster(string name, GameObject pbObj) { m_Objects.Remove(name); if (m_Monsters.Exists(x => x == pbObj)) { m_Monsters.Remove(pbObj); } } public static List GetMonsters() { return m_Monsters; } } }