Beispiel #1
0
        public T Spawn(SpawnDataContainer container)
        {
            if (pool.Count < 2)
            {
                PopulatePool();
            }

            var dequeued = pool.Dequeue();

            dequeued.OnSpawn(container);
            return(dequeued);
        }
 public abstract void OnSpawn(SpawnDataContainer container);
 public static T RequestSpawnForType <T>(T targetType, SpawnDataContainer container) where T : PoolableObject
 {
     return(_instance.pools.Find(x => x.GetPoolType() == targetType).Spawn(container) as T);
 }