Example #1
0
 public void Initialize(PoolableObject parPrefabObject, int number, Transform parent)
 {
     _parent        = parent;
     _objectsInPool = new List <PoolableObject>();
     _prefab        = parPrefabObject;
     for (int i = 0; i < number; ++i)
     {
         PoolableObject go = Object.Instantiate(_prefab, _parent);
         go.DeInit();
         _objectsInPool.Add(go);
     }
 }
Example #2
0
        private PoolableObject IncreaseSize(int number)
        {
            int index = _objectsInPool.Count - 1;

            for (int i = 0; i < number; ++i)
            {
                PoolableObject go = Object.Instantiate(_prefab, _parent);
                go.DeInit();
                _objectsInPool.Add(go);
            }
            return(_objectsInPool[index]);
        }
Example #3
0
 public void ReleasePooledObject(PoolableObject obj)
 {
     obj.DeInit();
 }