Пример #1
0
        public ClassObjectPool <T> GetOrCreateClassObjectPool <T>(int maxCount)
            where T : class, new()
        {
            Type   type = typeof(T);
            object obj  = null;

            if (!m_classObjectPoolDict.TryGetValue(type, out obj) || obj == null)
            {
                ClassObjectPool <T> newPool = new ClassObjectPool <T>(maxCount);
                m_classObjectPoolDict.Add(type, newPool);
                return(newPool);
            }
            return(obj as ClassObjectPool <T>);
        }
Пример #2
0
 public void InitGoPool(Transform goPool, Transform sceneGos)
 {
     m_gameObjectItemClassPool = ObjectManager.Instance.GetOrCreateClassObjectPool <GameObjectItem>(1000);
     m_goPool   = goPool;
     m_sceneGos = sceneGos;
 }