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

            switch (IceDecision)
            {
            case "yes":
                bool enoughmoney = player.wallet.ConfirmWalletBalance(ice.cost);
                {
                    if (enoughmoney)
                    {
                        player.wallet.SubtractFromBalance(ice.cost);
                        player.inventory.AddToIce();
                    }
                    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.");
                SellIce(ice, player, day);
                break;
            }
        }