Example #1
0
        public void AddOrder(Order order)
        {
            if (ordersForLaterTurn.Ptr == null)
            {
                ordersForLaterTurn = NativeEnumerable <Order> .Create(UnsafeUtilityEx.Malloc <Order>(16, Allocator.Persistent), 16);

                UnsafeUtility.MemClear(ordersForLaterTurn.Ptr + 1, 15 * sizeof(Order));
            }
            else if (ordersForLaterTurnCount == ordersForLaterTurn.Length)
            {
                var newEnumerable = NativeEnumerable <Order> .Create(UnsafeUtilityEx.Malloc <Order>(ordersForLaterTurnCount << 1, Allocator.Persistent), ordersForLaterTurnCount << 1);

                UnsafeUtilityEx.MemCpy(newEnumerable.Ptr, ordersForLaterTurn.Ptr, ordersForLaterTurnCount);
                UnsafeUtility.MemClear(newEnumerable.Ptr + ordersForLaterTurnCount + 1, (ordersForLaterTurnCount - 1) * sizeof(Order));
                ordersForLaterTurn.Dispose(Allocator.Persistent);
                ordersForLaterTurn = newEnumerable;
            }
            ordersForLaterTurn[ordersForLaterTurnCount++] = order;
        }
Example #2
0
 public void Dispose()
 {
     initialHpTable.Dispose(Allocator.Persistent);
     movePowerTable.Dispose(Allocator.Persistent);
     maxHpTable.Dispose(Allocator.Persistent);
     paintCostTable.Dispose(Allocator.Persistent);
     paintPointTable.Dispose(Allocator.Persistent);
     paintIntervalTable.Dispose(Allocator.Persistent);
     generationCostTable.Dispose(Allocator.Persistent);
     generationIntervalTable.Dispose(Allocator.Persistent);
     generationRequiredHpTable.Dispose(Allocator.Persistent);
     attackCostTable.Dispose(Allocator.Persistent);
     attackPointTable.Dispose(Allocator.Persistent);
     attackIntervalTable.Dispose(Allocator.Persistent);
     attackRangeTable.Dispose(Allocator.Persistent);
     livingCostTable.Dispose(Allocator.Persistent);
     livingIntervalTable.Dispose(Allocator.Persistent);
     cellMoveCostTable.Dispose(Allocator.Persistent);
     viewRangeTable.Dispose(Allocator.Persistent);
 }
Example #3
0
 public void Dispose()
 {
     Cells.Dispose(Allocator.Persistent);
 }