Exemple #1
0
        private List <GameObject> InstantiatePoolObjectsAndAddToMaster(PoolTypes pool)
        {
            List <GameObject> objectPool = new List <GameObject>();

            for (int i = 0; i < pool.size; i++)
            {
                var go = AddNewGameObjectToPool(pool.asset, objectPool);
                go.SetActive(false);
            }

            return(objectPool);
        }
Exemple #2
0
        private PoolTypes CreatePoolFromAsset(IPoolableAsset poolAsset)
        {
            PoolTypes newPool = new PoolTypes
            {
                tag                 = poolAsset.GetIPoolableAssetName(),
                asset               = poolAsset.GetIPoolableAsset(),
                prefab              = null,
                size                = poolAsset.GetNumberToPool(),
                canExpand           = poolAsset.GetIsPoolExpandable(),
                isSelfInstantiating = true,
                sceneName           = GetActiveScene()
            };

            poolTypes.Add(newPool);
            return(newPool);
        }
Exemple #3
0
        private void AddPoolToMaster(PoolTypes newPoolRef)
        {
            List <GameObject> objectPool = InstantiatePoolObjectsAndAddToMaster(newPoolRef);

            poolMaster.Add(newPoolRef.tag, objectPool);
        }