コード例 #1
0
 public Pool(PoolModel poolModel, Transform poolParentTransform)
 {
     _poolModel       = poolModel;
     _poolObjectQueue = new Queue <PoolObject>();
     CreatePoolParent(poolParentTransform);
     InitializePool();
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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>());
        }
コード例 #4
0
 public void InitializePoolObject(PoolModel pool)
 {
     _pool = pool;
 }