public CoroutineWrapper StartWrapper(IEnumerator rIEnum) { var rCourtineObj = UtilTool.CreateGameObject(this.mCoroutineRootObj, "coroutine"); CoroutineHandler rHandler = rCourtineObj.ReceiveComponent <CoroutineHandler>(); return(rHandler.StartHandler(rIEnum)); }
public GameObject Alloc() { if (this.objectsCache.Count == 0) { return(UtilTool.CreateGameObject(this.templateGo)); } GameObject rGo = this.objectsCache.Pop(); rGo.transform.parent = null; return(rGo); }
public GameObjectPool(string rPoolName, int rInitCount = 0) { 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(string rPoolName, GameObject rTemplateObj, int rInitCount = 0) { this.objectsCache = new Stack <GameObject>(); this.rootGo = UtilTool.CreateGameObject(rPoolName); this.rootGo.SetActive(false); this.rootGo.transform.position = new Vector3(0, 1000, 0); this.templateGo = rTemplateObj; for (int i = 0; i < rInitCount; i++) { GameObject rGo = UtilTool.CreateGameObject(this.templateGo, this.rootGo); this.objectsCache.Push(rGo); } }