コード例 #1
0
ファイル: Game.cs プロジェクト: BeeXiong/Lemonade
        private void SellLemonadeCups(Day currentDay, string lemonadeTaste, Random randomNumber, Human gamePlayer, int priceModifier)
        {
            int totalLemonadeCups;

            foreach (Customer potientialCustomer in currentDay.lemonadeCustomers)
            {
                totalLemonadeCups = gamePlayer.gameInventory.gameLemonadeCups.Count();
                Console.WriteLine("\nA new customer is approaching");
                Console.Write("*");
                Thread.Sleep(100);
                Console.Write("*");
                Thread.Sleep(100);
                Console.Write("*");
                Thread.Sleep(100);
                Console.Write("*");
                Thread.Sleep(100);
                if (potientialCustomer.TastePreference == lemonadeTaste && currentDay.WeatherCondition.Temperature > 80 && totalLemonadeCups != 0)
                {
                    decimal chanceTobuy = (1 * priceModifier);
                    if (chanceTobuy == 1)
                    {
                        currentDay.purchasingCustomers.Add(potientialCustomer);
                        gamePlayer.gameInventory.gameLemonadeCups.RemoveAt(0);
                        Console.WriteLine("The customer purchased some lemonade!");
                    }
                }
                else if (potientialCustomer.TastePreference == lemonadeTaste && currentDay.WeatherCondition.Temperature > 60 && totalLemonadeCups != 0)
                {
                    decimal chanceTobuy = randomNumber.Next(1, (2 * priceModifier));
                    if (chanceTobuy == 1)
                    {
                        currentDay.purchasingCustomers.Add(potientialCustomer);
                        gamePlayer.gameInventory.gameLemonadeCups.RemoveAt(0);
                        Console.WriteLine("The customer purchased some lemonade!");
                    }
                }
                else if (potientialCustomer.TastePreference == lemonadeTaste && currentDay.WeatherCondition.Temperature > 80 && currentDay.WeatherCondition.Condition == "raining" && totalLemonadeCups != 0)
                {
                    decimal chanceTobuy = randomNumber.Next(1, (3 * priceModifier));
                    if (chanceTobuy == 1)
                    {
                        currentDay.purchasingCustomers.Add(potientialCustomer);
                        gamePlayer.gameInventory.gameLemonadeCups.RemoveAt(0);
                        Console.WriteLine("The customer purchased some lemonade!");
                    }
                }
                if (potientialCustomer.TastePreference != lemonadeTaste && currentDay.WeatherCondition.Temperature > 80 && totalLemonadeCups != 0)
                {
                    decimal chanceTobuy = randomNumber.Next(1, (5 * priceModifier));
                    if (chanceTobuy == 1)
                    {
                        currentDay.purchasingCustomers.Add(potientialCustomer);
                        gamePlayer.gameInventory.gameLemonadeCups.RemoveAt(0);
                        Console.WriteLine("The customer purchased some lemonade!");
                    }
                }
                else if (potientialCustomer.TastePreference != lemonadeTaste && currentDay.WeatherCondition.Temperature > 60 && totalLemonadeCups != 0)
                {
                    decimal chanceTobuy = randomNumber.Next(1, (7 * priceModifier));
                    if (chanceTobuy == 1)
                    {
                        currentDay.purchasingCustomers.Add(potientialCustomer);
                        gamePlayer.gameInventory.gameLemonadeCups.RemoveAt(0);
                        Console.WriteLine("The customer purchased some lemonade!");
                    }
                }
                else if (totalLemonadeCups == 0)
                {
                    Console.WriteLine("You are out of Lemonade for the day!");
                    break;
                }
            }
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: BeeXiong/Lemonade
 private void AddRevenueToBank(Human gamePlayer, decimal dailyRevenue)
 {
     gamePlayer.playerWallet.TotalDollars = gamePlayer.playerWallet.TotalDollars + dailyRevenue;
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: BeeXiong/Lemonade
 public void RemoveFundsAfterPurchase(bool customerConfirmation, bool fundsConfirmation, Human gamePlayer, decimal transactionAmount)
 {
     if (customerConfirmation == true && fundsConfirmation == true)
     {
         gamePlayer.playerWallet.TotalDollars = gamePlayer.playerWallet.TotalDollars - transactionAmount;
     }
 }