Ejemplo n.º 1
0
        public GameObjectPool(GameObject rRootGo, GameObject rPrefabGo, int rInitCount = 0)
        {
            this.mPrefabGo   = rPrefabGo;
            this.mObjectPool = new TObjectPool <GameObject>(OnAlloc, OnFree, OnDestroy);

            this.mRootGo = rRootGo;
            this.mRootGo.SetActive(false);

            for (int i = 0; i < rInitCount; i++)
            {
                this.mObjectPool.Alloc();
            }
        }
Ejemplo n.º 2
0
        public GameObjectPool(string rPoolName, GameObject rPrefabGo, int rInitCount = 0)
        {
            this.mPrefabGo   = rPrefabGo;
            this.mObjectPool = new TObjectPool <GameObject>(OnAlloc, OnFree, OnDestroy);

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

            for (int i = 0; i < rInitCount; i++)
            {
                this.mObjectPool.Alloc();
            }
        }
Ejemplo n.º 3
0
        public GameObjectPool(GameObject rRootGo, GameObject rPrefabGo, int rInitCount = 0)
        {
            this.mPrefabGo   = rPrefabGo;
            this.mObjectPool = new TObjectPool <GameObject>(OnAlloc, OnFree, OnDestroy);

            this.mRootGo = rRootGo;
            this.mRootGo.SetActive(false);

            var rInitAllocGos = new List <GameObject>();

            for (int i = 0; i < rInitCount; i++)
            {
                rInitAllocGos.Add(this.mObjectPool.Alloc());
            }
            for (int i = 0; i < rInitAllocGos.Count; i++)
            {
                this.mObjectPool.Free(rInitAllocGos[i]);
            }
        }
Ejemplo n.º 4
0
 public FrameObjectPool()
 {
     this.mObjectPool = new TObjectPool <FrameObject>(this.OnAlloc, this.OnFree, this.OnDestroy);
 }