Ejemplo n.º 1
0
        public T Create <T>(string key) where T : Component, new()
        {
            ObjectPoolBase pool = null;

            if (poolDictionary.TryGetValue(key, out pool) == false)
            {
                return(null);
            }

            Type poolType = pool.GetType();

            if (poolType == typeof(ObjectPool <T>))
            {
                ObjectPool <T> componentPool = pool as ObjectPool <T>;
                return(componentPool.Create());
            }
            else
            {
                return(null);
            }
        }