using System.Collections; using System.Collections.Generic; using UnityEngine; public class Pool { public Dictionary dic = new Dictionary(); public T Add(GameObject obj) { if (dic.ContainsKey(obj.name)) return dic[obj.name]; else { obj.name = $"{dic.Keys.Count}"; dic.Add(obj.name, obj.GetComponent()); return dic[obj.name]; } } //Pool pool = new Pool(); //void OnCombo2(int cntDestroy) //{ // ComboEffect effect = (new List(pool.dic.Values)).Find(a => !a.gameObject.activeSelf); // //ComboEffect effect = null; // //var list = pool.dic.GetEnumerator(); // //while (list.MoveNext()) // //{ // // if (!list.Current.Value.gameObject.activeSelf) // // { // // effect = list.Current.Value; // // break; // // } // //} // if (effect == null) // effect = pool.Add(ResourcePool.ObjectCreateStatic(prefabComboEffect, transform)); // effect.OnInitialized(cntDestroy); //} }