public CustomObjectPool <T> GetObjectPool <T>(Func <bool, Func <T> > failCallback = null) where T : new() { object objectPool; var type = typeof(T); if (!objectPools.TryGetValue(type, out objectPool)) { var f = failCallback(false); objectPool = new CustomObjectPool <T>(f); objectPools.Add(type, objectPool); } return(objectPool as CustomObjectPool <T>); }
public void RegisterCustomObjectPool <T>(CustomObjectPool <T> objectPool) { objectPools.Add(typeof(T), objectPool); }