public void StartBuildingShip(ShipRecipe shipRecipe) { var ship = new Ship(shipRecipe.shipID, shipRecipe.shipName, shipRecipe.shipMass); var manufactoryTask = new ManufactoryTask(ship); ManufactoryTasks.Add(manufactoryTask); onManufactoryTasksChange?.Invoke(); }
public override ManufactoryData CreateSaveData() { if (ShipsInStorage == null) { return(null); } // Create ShipsInStorageData var shipsData = new List <Ship>(ShipsInStorage); var tasksData = new List <ManufactoryTaskData>(ManufactoryTasks.Count); ManufactoryTasks.ForEach(t => tasksData.Add(new ManufactoryTaskData(t))); // Create ManufactoryData var saveData = new ManufactoryData(LevelModule.Level, shipsData, tasksData); return(saveData); }
private void Update() { tasksToRemove = new List <ManufactoryTask>(); foreach (var task in ManufactoryTasks) { if (task.TripClock.TimeLeft() > 0) { continue; } tasksToRemove.Add(task); } tasksToRemove.ForEach(e => { if (ManufactoryTasks.Contains(e)) { ManufactoryTasks.Remove(e); DoneBuildingShip(e); } }); }