コード例 #1
0
        public void RunDay(int currentDay, double money, string forecast, int temp, Day day)
        {
            UserInterface.MenuReadout(currentDay, money, forecast, temp);
            UserInterface.DisplayInventory(player.inventory);


            for (int i = 0; i < day.customers.Count; i++)
            {
                if (player.PitcherCheck() == true)
                {
                    bool enough = player.IngredientsCheck();
                    if (enough == true)
                    {
                        player.pitcher.FillPitcher();
                    }
                    else
                    {
                        break;
                    }
                }


                if (day.customers[i].ChanceToBuy(day.weather.conditionInt, day.weather.temperature, satisfaction) == true)
                {
                    bool enough = player.CreateLemonadeCup(player.recipe.ammountOfIceCubes, player.inventory.iceCubes.Count, player.inventory.cups.Count);
                    if (enough == true)
                    {
                        Console.WriteLine(day.customers[i].name + " buys!");
                        player.wallet.GainMoney(player.recipe.pricePerCup);
                        player.pitcher.SellCups(1);
                        ChangeSatisfaction(player.recipe.ammountOfIceCubes, player.recipe.ammountOfLemons, player.recipe.ammountOfSugarCubes, player.recipe.pricePerCup, day.weather.temperature);
                        Console.WriteLine(satisfaction);
                    }
                    else
                    {
                        Console.ReadLine();
                        break;
                    }
                }
            }

            double endMoney = player.wallet.GetMoney();

            player.wallet.GetDailyGains(startMoney, endMoney);
            player.wallet.GetTotalGains();
            player.inventory.IceMelts();
            player.pitcher.DumpPitcher();
            player.inventory.LemonsExpire(currentDay);
            Console.WriteLine("Press enter to continue.");
            Console.ReadLine();
        }