public Pool(PoolModel poolModel, Transform poolParentTransform) { _poolModel = poolModel; _poolObjectQueue = new Queue <PoolObject>(); CreatePoolParent(poolParentTransform); InitializePool(); }
private void CreateObjectToPool(PoolModel pool, int size) { Debug.Log($"Creating {size} item into {pool.Name} pool"); for (int i = 0; i < size; i++) { CreateObjectToPool(pool); } }
private void CreateObjectToPool(PoolModel pool) { PoolObject poolObject = pool.PoolObject; GameObject go = GameObject.Instantiate(poolObject.gameObject, _poolParentTransform); go.GetComponent <PoolObject>().InitializePoolObject(_poolModel); _poolObjectQueue.Enqueue(go.GetComponent <PoolObject>()); }
public void InitializePoolObject(PoolModel pool) { _pool = pool; }