コード例 #1
0
ファイル: Day.cs プロジェクト: gregmanthey/dCC-LemonadeStand
        public void RunDay(Player player, Weather weather)
        {
            UI.DisplayActualWeatherForToday(weather);
            UI.DisplayPlayerInventory(player);

            while (UI.DoesUserWantTo("buy anything from the store"))
            {
                Store.DisplayItemsForSale();
                Store.ProcessOrder(player);
                UI.DisplayPlayerInventory(player);
            }

            player.recipe.DisplayRecipe();

            while (UI.DoesUserWantTo("change the recipe"))
            {
                player.ChangeRecipe();
                player.recipe.DisplayRecipe();
            }

            int cupsSold = 0;

            if (player.RanOutOfInventoryItems())
            {
                return;
            }
            player.MakePitcherOfLemonade();
            List <Customer> buyingCustomers = GenerateCustomerList(weather, player.recipe);

            foreach (Customer buyingCustomer in buyingCustomers)
            {
                if (buyingCustomer.isBuying == true)
                {
                    if (player.RanOutOfInventoryItems())
                    {
                        break;
                    }
                    cupsSold++;
                    player.AdjustInventoryAfterSale(cupsSold);
                }
            }
        }