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; }
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); }
public void Dispose() { Cells.Dispose(Allocator.Persistent); }