Beispiel #1
0
        // member methods
        public void GoToStore(Player player)
        {
            lemonsBought   = 0;
            sugarBought    = 0;
            cupsBought     = 0;
            iceCubesBought = 0;

            lemonsBought   = UserInterface.BuyLemons();
            sugarBought    = UserInterface.BuySugar();
            iceCubesBought = UserInterface.BuyIceCubes();
            cupsBought     = UserInterface.BuyCups();
            double expense = TotalExpenseCalc();

            if (expense > player.bank)
            {
                Console.WriteLine("Oops. Looks like you don't have enough money for that purchase.");
                GoToStore(player);
            }
            else
            {
                player.bank -= expense;
                ItemsBought(player);
            }
        }