using AI.Base; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using UnityEngine.UIElements; public class EnemySpawnerManager : MonoBehaviour { public static EnemySpawnerManager Instance; [SerializeField] public GameObject GoblerPreFab; public static Dictionary Goblers = new Dictionary(); public static Action UpdateTick; public static Action GizmoTick; public static int MaxGoblers = 1; public class Gobler { public GameObject Object; public GoblerStateManager Manager; public Gobler(GameObject obj, GoblerStateManager manager) { Object = obj; Manager = manager; } } public void Awake() { Instance = this; } public static void RemoveGobler(GoblerStateManager goblerManager){ Destroy(Goblers[goblerManager]); Goblers.Remove(goblerManager); } public void Update() { if (Goblers.Count() < MaxGoblers){ var gobler = Instantiate(GoblerPreFab, this.transform.position, Quaternion.identity); Goblers.Add(new GoblerStateManager(gobler), gobler); } UpdateTick?.Invoke(); } public static void OnDrawGizmos() { GizmoTick?.Invoke(); } }