using System.Collections.Generic; using UnityEngine; public class ActorInfo : MonoBehaviour { //[RuntimeInitializeOnLoadMethod] //static void OnRuntimeMethodLoad() { new GameObject("ActorInfo").AddComponent(); } public static ActorInfo Ins; private void Awake() { Ins = this; DontDestroyOnLoad(gameObject); } private ObjectPool> listPool = new ObjectPool>(); /// /// 타입, <노드, 액터들> /// Dictionary>> dic_actor = new Dictionary>>(); public void Destroy_Mob() { foreach (var role in dic_actor) { if (role.Key == eRole.Mob) { foreach (var actor in role.Value) { for (int i = 0; i < actor.Value.Count; i++) { Destroy(actor.Value[i].gameObject); } } role.Value.Clear(); } } } public void Add_Actor(Actor actor, eRole role, int node = 0) { // 생성한 액터 추가 if (!dic_actor[role].ContainsKey(node)) dic_actor[role].Add(node, new List()); dic_actor[role][node].Add(actor); } public void Release_Actors(List actors) { actors.Clear(); listPool.Release(actors); } }