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(); } }
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(); } }
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]); } }
public FrameObjectPool() { this.mObjectPool = new TObjectPool <FrameObject>(this.OnAlloc, this.OnFree, this.OnDestroy); }