public ObjectPool GetObjPool(OBJ_POOL_TYPE type) { ObjectPool objPool = null; if (objPoolDict.TryGetValue(type, out objPool)) { return(objPool); } return(objPool); }
public ObjectPool <T> GetObjPoolWithType <T>(OBJ_POOL_TYPE type) where T : Component { ObjectPoolObj obj = null; ObjectPool <T> objPool = null; if (objPoolWithCompDict.TryGetValue(type, out obj)) { objPool = (ObjectPool <T>)obj.GetComponent <ObjectPoolObj>().objPool; return(objPool); } return(objPool); }
public ObjectPool LoadObjPool(OBJ_POOL_TYPE type, string poolName, GameObject prefab, int minNum) { ObjectPool objPool = null; if (!objPoolDict.TryGetValue(type, out objPool)) { // if no pool for the type, create one objPool = new ObjectPool(poolName, prefab, minNum, true, true); objPool.poolGameObj.transform.SetParent(transform); objPoolDict.Add(type, objPool); } return(objPool); }
public ObjectPool <T> LoadObjPoolWithType <T>(OBJ_POOL_TYPE type, string poolName, GameObject prefab, int minNum) where T : Component { ObjectPoolObj obj = null; ObjectPool <T> objPool = null; if (!objPoolWithCompDict.TryGetValue(type, out obj)) { // if no pool for the type, create one objPool = new ObjectPool <T>(poolName, prefab, minNum, true, true); objPool.poolGameObj.transform.SetParent(transform); objPoolWithCompDict.Add(type, objPool.objPoolObj); } else { objPool = (ObjectPool <T>)obj.GetComponent <ObjectPoolObj>().objPool; } return(objPool); }
public ObjPoolInfo(OBJ_POOL_TYPE type, ObjectPool objPool, int minNum) { this.type = type; this.objPool = objPool; }