Beispiel #1
0
        public GameObjectPool(GameObject rRootGo, GameObject rPrefabGo, int rInitCount = 0)
        {
            mPrefabGo   = rPrefabGo;
            mObjectPool = new TObjectPool <GameObject>(OnAlloc, OnFree, OnDestroy);

            RootGo = rRootGo;
            RootGo.SetActive(false);
            for (int i = 0; i < rInitCount; i++)
            {
                mObjectPool.Alloc();
            }
        }
Beispiel #2
0
        public GameObjectPool(string rPoolName, GameObject rPrefabGo, int rInitCount = 0)
        {
            mPrefabGo   = rPrefabGo;
            mObjectPool = new TObjectPool <GameObject>(OnAlloc, OnFree, OnDestroy);

            RootGo = UtilTool.CreateGameObject(rPoolName);
            RootGo.SetActive(false);
            RootGo.transform.position = new Vector3(0, 1000, 0);

            for (int i = 0; i < rInitCount; i++)
            {
                mObjectPool.Alloc();
            }
        }