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;
     }
 }
Exemplo n.º 3
0
 protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator, int initialSize)
 {
     pool = new CustomAllocatedObjectPool <T>(allocator, null, initialSize);
 }
Exemplo n.º 4
0
 protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator)
 {
     StaticInit(allocator, 0);
 }
 public ConditionVariable()
 {
     eventPool = new CustomAllocatedObjectPool <LinkedListNode <ManualResetEvent> >(AllocateEvent, null);
 }
Exemplo n.º 6
0
 protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator, CustomAllocatedObjectPool <T> .FreeDelegate free, int initialSize, int maxItems)
 {
     _pool = new CustomAllocatedObjectPool <T>(allocator, free, initialSize, maxItems);
 }
Exemplo n.º 7
0
 protected static void StaticInit(CustomAllocatedObjectPool <T> .AllocateDelegate allocator, CustomAllocatedObjectPool <T> .FreeDelegate free, int maxItems)
 {
     StaticInit(allocator, free, 0, maxItems);
 }
Exemplo n.º 8
0
 static protected void ResetPool(int initialSize, CustomAllocatedObjectPool <T> .FreeDelegate free)
 {
     _pool.Reset(initialSize, free);
 }