예제 #1
0
 // constructor
 public Store()
 {
     lemon = new Lemon();
     ice   = new Ice();
     sugar = new Sugar();
     cup   = new Cup();
 }
예제 #2
0
 //constructor
 public Inventory()
 {
     cups   = new Cup();
     lemons = new Lemon();
     sugar  = new Sugar();
     ice    = new Ice();
 }
예제 #3
0
 public void AddSugar(decimal amount)
 {
     for (int i = 0; i < amount; i++)
     {
         Sugar sugar = new Sugar();
         sugars.Add(sugar);
     }
 }
예제 #4
0
        private void SellSugar(Sugar sugar, Player player, Day day)
        {
            Console.WriteLine("Need sugar? No problem!"
                              + $" \n type 'yes' to purchase 25 cups of sugar for ${sugar.cost};"
                              + " \n type 'no' to return to the store;"
                              + " \n type 'quit' to exit the game.");
            string SugarDecision = Console.ReadLine().ToLower().Trim();

            switch (SugarDecision)
            {
            case "yes":
                bool enoughmoney = player.wallet.ConfirmWalletBalance(sugar.cost);
                {
                    if (enoughmoney == true)
                    {
                        player.wallet.SubtractFromBalance(sugar.cost);
                        player.inventory.AddToSugar();
                    }
                    else
                    {
                        Console.WriteLine("You don't have enough money to purchase this item..."
                                          + " \n You will need to use up your current inventory or restart the game after this round."
                                          + " \n Press enter to return back to the store.");
                        Console.ReadLine();
                    }
                }
                Console.Clear();
                StoreFront(player, day);
                break;

            case "no":
                StoreFront(player, day);
                break;

            case "quit":
                Environment.Exit(0);
                break;

            default:
                Console.Clear();
                Console.WriteLine("Please select a valid option.");
                SellSugar(sugar, player, day);
                break;
            }
        }