Exemplo n.º 1
0
        //member methods

        public void VisitStand(Day day, Weather weather, Recipe recipe, Wallet wallet, Inventory inventory)
        {
            for (int j = 0; j < day.NumberOfCustomers; j++)
            {
                CheckWeather(weather, recipe, wallet, inventory);
                CheckPrice(recipe, weather, wallet, inventory);
                BuyLemonade(recipe, wallet, inventory);
            }
        }
Exemplo n.º 2
0
 public static void NumberOfLemonades(Inventory inventory)
 {
     Console.WriteLine("You have made " + inventory.cupsOfLemonade + " cups of Lemonade.");
 }
Exemplo n.º 3
0
 public static void DisplaysWallet(Inventory inventory)
 {
     Console.WriteLine("Your wallet has $" + inventory.wallet);
 }
Exemplo n.º 4
0
        public void ReadFile(Player player, Inventory inventory, Game game)
        {
            string        line;
            string        path       = "LemonadeSaveFile.txt";
            string        fullPath   = System.IO.Path.GetFullPath(path);
            List <string> textToRead = new List <string>();

            try {
                System.IO.StreamReader file = new System.IO.StreamReader(fullPath);
                if ((line = file.ReadLine()) != null)
                {
                    player.SetName(line);
                }
                if ((line = file.ReadLine()) != null)
                {
                    player.SetCash(Convert.ToDouble(line));
                }
                inventory.Reset();
                if ((line = file.ReadLine()) != null)
                {
                    //lemons
                    inventory.AddLemons(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //ice
                    inventory.AddIces(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //sugar
                    inventory.AddSugars(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //cups
                    inventory.AddCups(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //total spent
                    player.SetTotalSpent(Convert.ToDouble(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //total profit
                    player.SetTotalProfit(Int32.Parse(line));
                }
                if ((line = file.ReadLine()) != null)
                {
                    //current day
                    game.SetCurrentDay(Int32.Parse(line));
                }
                Console.WriteLine("Game loaded.");
                file.Close();
            }
            catch
            {
                Console.WriteLine("Error trying to load file.");
            }
        }
Exemplo n.º 5
0
 public LemonadeStand()
 {
     cupsPerPitcher = 12;
     inventory      = new Inventory();
 }
Exemplo n.º 6
0
 public Player()
 {
     inventory = new Inventory();
     recipe    = new Recipe();
     wallet    = new Wallet();
 }
Exemplo n.º 7
0
 public Store(Player player)
 {
     playerWallet    = player.wallet;
     playerInventory = player.inventory;
 }
Exemplo n.º 8
0
 public Player()
 {
     Wallet    wallet    = new Wallet();
     Inventory inventory = new Inventory();
 }
Exemplo n.º 9
0
 public Player()
 {
     CurrentMoney     = new Wallet();
     CurrentInventory = new Inventory();
     recipe           = new Recipe();
 }
Exemplo n.º 10
0
 public static void EndDay(Inventory inventory)
 {
     Console.WriteLine("You ended today with $" + inventory.moneyCounter + ". and all of your ice has melted");
     Console.ReadLine();
     Console.Clear();
 }
Exemplo n.º 11
0
 public static void DisplayInventory(Inventory inventory)
 {
     Console.WriteLine("\nYou now have $" + inventory.moneyCounter + " and the following ingredients and supplies:\n" + inventory.sugar + " cups of sugar\n" + inventory.lemons + " lemons\n" + inventory.iceCubes + " ice cubes\n" + inventory.cups + " paper cups.\n");
 }