public void CheckForCustomerPurchase(Day day, Customer customer, Player player) { bool multipleCups = true; customer.ChangeChancesDueToPrice(player.recipe.pricePerCup, day.standardPricePerCup); do { int buyCheck = rand.Next(0, customer.Chances); if (UserInterface.CheckForEmptyPitcher(player.pitcher)) { multipleCups = false; break; } else if (customer.BuyLemonade(buyCheck)) { player.pitcher.cupsLeftInPitcher--; day.cupsSold++; player.wallet.ReceiveMoneyFromCustomer(player.recipe.pricePerCup); day.profits += player.recipe.pricePerCup; player.totalProfits += day.profits; } else { multipleCups = false; } }while (multipleCups == true); }
public void SalePhase(Day day, Player player) { bool firstPitcherCheck = UserInterface.CheckIfEnoughIngredients(player); while (firstPitcherCheck) { player.pitcher = player.MakeNewPitcher(); foreach (Customer customer in day.customers) { if (UserInterface.CheckForEmptyPitcher(player.pitcher)) { if (UserInterface.CheckIfEnoughIngredients(player)) { player.pitcher = player.MakeNewPitcher(); } else { break; } } CheckForCustomerPurchase(day, customer, player); } firstPitcherCheck = false; } DisplayEndOfDay(day, player); }