Esempio n. 1
0
        void Update()
        {
            float now = Time.time;

            if (pool.Count > 0)
            {
                if (nextGCStart > 0 && now >= nextGCStart)
                {
                    nextGCStart      = -1;
                    nextObjectRemove = now + garbageCollectionInterval;
                }

                if (nextObjectRemove > 0 && now >= nextObjectRemove)
                {
                    nextObjectRemove = now + garbageCollectionInterval;
                    PoolObject poolObj = pool.Dequeue();
                    Destroy(poolObj.gameObject);
                }
            }
        }
Esempio n. 2
0
 public void DestroyShape(PoolObject shape)
 {
     shape.PutIntoPool();
 }
Esempio n. 3
0
 public void PutIntoPool(PoolObject bullet)
 {
     pool.PutIntoPool(bullet);
 }