public void EndOfDayResponsibilities(Player player) { dailyProfitOrLoss = player.wallet.Money - startOfDayCash; UserInterface.DisplayDailyTotals(dailyProfitOrLoss, player.wallet.Money, player.name); player.pitcher.EmptyPitcher(); UserInterface.ClearDisplay(); }
public Player() { inventory = new Inventory(); wallet = new Wallet(); recipe = new Recipe(); pitcher = new Pitcher(); name = UserInterface.GetUserName(); UserInterface.ClearDisplay(); }
public Game() { player = new Player(); store = new Store(); random = new Random(); days = new List <Day>(); weeklyForecast = new List <Weather>(); gameLength = UserInterface.DetermineGameLength(); UserInterface.ClearDisplay(); RunWeek(); }
public bool CheckStockIngredients(Player player) { if (player.inventory.lemons.Count() < player.recipe.amountOfLemons || player.inventory.sugarCubes.Count() < player.recipe.amountOfSugarCubes || player.inventory.iceCubes.Count() < player.recipe.amountOfIceCubes) { UserInterface.StoreIsSoldOut("lemonade"); UserInterface.DisplayDailyTotals(0, player.wallet.Money, player.name); UserInterface.ClearDisplay(); return(false); } else { return(true); } }
public void RunDay(Player player, Random random, Weather weather) { // Randomly adjust weather based upon forecasted weather RandomlyAdjustWeather(weather, random); // Display today's weather UserInterface.DisplayWeather(weather.temperature, weather.condition); UserInterface.ClearDisplay(); player.recipe.SetRecipe(); UserInterface.ClearDisplay(); if (CheckStockIngredients(player) == false) { return; } player.pitcher.FillPitcher(player.recipe, player); amountOfPeople = random.Next(5, 20); // Run through however many people come to the stand that day for (int i = 0; i < amountOfPeople; i++) { customers.Add(new Customer(random, weather, player.recipe)); CheckStockCups(player); if (customers[i].wantsLemonade == true && player.pitcher.cupsInPitcher > 0) { player.pitcher.PourAGlass(player); player.wallet.Money += player.recipe.pricePerGlass; } else if (customers[i].wantsLemonade == true && player.pitcher.cupsInPitcher <= 0) { if (CheckStockIngredients(player) == false) { return; } UserInterface.AlertToNewPitcher(); player.pitcher.FillPitcher(player.recipe, player); player.pitcher.PourAGlass(player); player.wallet.Money += player.recipe.pricePerGlass; } UserInterface.CustomerStopsByShop(customers[i].name, customers[i].wantsLemonade); UserInterface.ClearDisplay(); } EndOfDayResponsibilities(player); }
public void RunWeek() { for (int i = 0; i < gameLength; i++) { UserInterface.DisplayWeekCounter(i + 1); GenerateWeeklyForecast(random); UserInterface.DisplayForecast(weeklyForecast); UserInterface.ClearDisplay(); for (int j = 0; j < 7; j++) { // Display User Inventory UserInterface.DisplayInventory(player.inventory.lemons.Count(), player.inventory.sugarCubes.Count(), player.inventory.iceCubes.Count(), player.inventory.cups.Count()); UserInterface.ClearDisplay(); // Go to store for the day RunStorePhase(); UserInterface.ClearDisplay(); // Run the stand for one day days.Add(new Day(player, random, weeklyForecast[j])); // Check if player is broke, end game if so if (IsWalletEmpty() == true) { UserInterface.AllOutOfMoney(player.name); return; } } ClearForecast(); } UserInterface.DisplayGameFinish(player.name, player.wallet.Money); }