コード例 #1
0
ファイル: Manufactory.cs プロジェクト: AArtlone/SkyhookGame
    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();
    }
コード例 #2
0
ファイル: Manufactory.cs プロジェクト: AArtlone/SkyhookGame
    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);
    }
コード例 #3
0
ファイル: Manufactory.cs プロジェクト: AArtlone/SkyhookGame
    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);
            }
        });
    }