Esempio n. 1
0
        public void SetupNewPool <T>(PoolSettings settings) where T : MonoBehaviour, IPoolable
        {
            if (nextPoolIndex >= poolBuffer.Length)
            {
                throw new PoolException("[Pooler] Setup Pool: Max capacity Reached. Increase pooler size.");
            }
            var pool = new GenericPool <T>(settings);

            poolBuffer[nextPoolIndex]   = pool;
            prefabBuffer[nextPoolIndex] = settings.Prefab.GetHashCode();

            if (!isBackOffTimerRunning)
            {
                backoffTimer = new CountdownTimer("BackofftimerID", providerPoolRefreshTime, Domain.Enum.CountdownScope.Game, true, (id) => OnBackoffTimer(id), null);
                StartBackoffUpdateTimer();
                isBackOffTimerRunning = true;
            }
            nextPoolIndex++;
        }
Esempio n. 2
0
 public GenericPool(PoolSettings settings) : base(settings)
 {
     allLookup = new Dictionary <GameObject, T>();
     inUnused  = new Queue <T>();
 }
Esempio n. 3
0
 public PoolBase(PoolSettings settings)
 {
     this.settings = settings;
     outInuse      = new HashSet <GameObject>();
 }