using System.Collections; using System.Collections.Generic; using UnityEngine; public class EventManager : Singleton { [System.Serializable] public class ObjectCreate { public GameObject prefab; public Transform target; public Vector3 scale; public Vector3 pos; public GameObject create; public ObjectCreate() { } public ObjectCreate(GameObject prefab, Transform target, Vector3 scale, Vector3 pos) { this.prefab = prefab; this.target = target; this.scale = scale; this.pos = pos; } } Dictionary> dicEvent = new Dictionary>(); public void Add(string key, System.Action OnRecieve) { if(dicEvent.ContainsKey(key)) dicEvent[key] += OnRecieve; else dicEvent.Add(key, OnRecieve); //Debug.Log($"EventManager - {key} : {dicEvent[key].GetInvocationList().GetLength(0)} �� ���"); } public void Remove(string key, System.Action OnRecieve) { if (dicEvent.ContainsKey(key)) { dicEvent[key] -= OnRecieve; if (dicEvent[key] == null) { Debug.Log($"EventManager - {key} �� ��ϵ� �̺�Ʈ ��� ������"); dicEvent.Remove(key); } } } public void Invoke(string key, object value) { if (dicEvent.ContainsKey(key)) dicEvent[key](value); else Debug.LogWarning($"EventManager - {key} �� ��ϵ� �̺�Ʈ ����"); } }