예제 #1
0
    private void BrandNewDay(int day, LinkedListNode<Day> currentDay, GameStats game, LinkedList<Day> linkedDays)
    {
        if (currentDay != null)
        {
            // clears all constructions which who have been build after the previous buildpath ended
            game.ClearConstructing();
            // sets the projectlevels of that day
            game.whitehouse.projectLevel = currentDay.Value.WhitehouseLvl;
            game.cycletrack.projectLevel = currentDay.Value.CycletrackLvl;
            game.houses.projectLevel = currentDay.Value.HouseLvl;
            game.street.projectLevel = currentDay.Value.StreetLvl;
            game.carpool.projectLevel = currentDay.Value.CarpooltLvl;
            game.station.projectLevel = currentDay.Value.StationLvl;
            game.bus.projectLevel = currentDay.Value.BusLvl;
            game.train.projectLevel = currentDay.Value.TrainLvl;
            game.industry.projectLevel = currentDay.Value.IndustryLvl;

            // sets the income of that day
            game.coins = currentDay.Value.coins;
            game.points = currentDay.Value.points;
            game.citizen = currentDay.Value.citizen;
            game.capacity = currentDay.Value.capacity;
            game.environmentPoints = currentDay.Value.environmentPoints;

            // sets the industry values of that day
            game.maxBuilder = currentDay.Value.maxBuilder;
            game.builder = currentDay.Value.builder;
            game.discount = currentDay.Value.discount;

            // sets the constructiondays of the constructing projects of that day
            for (int i = 0; i < currentDay.Value.constructProjects.Count; i++)
            {
                foreach (BaseProject gbp in game.baseProjects)
                {
                    if (currentDay.Value.constructProjects.ContainsKey(gbp.projectName))
                    {
                        gbp.constructing = true;
                        gbp.constructionDays = currentDay.Value.constructProjects[gbp.projectName];
                    }
                }
            }

            // clear all the new days ahead
            while (currentDay != null)
            {
                var next = currentDay.Next;

                linkedDays.Remove(currentDay);
                currentDay = next;
            }

            // save the events of that day
            AddDaytoList(day, game, linkedDays);
        }
        else
        {
            // save the events of that day
            AddDaytoList(day, game, linkedDays);
        }
    }