public GameObjectPool(GameObject prefab, Transform root, int initialSize) { this.root = root; this.prefab = prefab; pool = new CustomAllocatedObjectPool <GameObject>(Allocate, Free, initialSize); compactedSize = initialSize; }
public void Dispose() { if (!disposed) { disposed = true; pool.Reset(0, Destroy); pool = null; } }
protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator, int initialSize) { pool = new CustomAllocatedObjectPool <T>(allocator, null, initialSize); }
protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator) { StaticInit(allocator, 0); }
public ConditionVariable() { eventPool = new CustomAllocatedObjectPool <LinkedListNode <ManualResetEvent> >(AllocateEvent, null); }
protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator, CustomAllocatedObjectPool <T> .FreeDelegate free, int initialSize, int maxItems) { _pool = new CustomAllocatedObjectPool <T>(allocator, free, initialSize, maxItems); }
protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator, CustomAllocatedObjectPool <T> .FreeDelegate free, int maxItems) { StaticInit(allocator, free, 0, maxItems); }
static protected void ResetPool(int initialSize, CustomAllocatedObjectPool <T> .FreeDelegate free) { _pool.Reset(initialSize, free); }