Exemplo n.º 1
0
        public void CheckForCustomer(Player player, Pitcher pitcher, Inventory inventory, Weather weather)
        {
            Thread.Sleep(20);
            int chance = dayRandom.Next(0, 100);

            if (chance <= 90 && !isRaining)
            {
                Customer customer = new Customer();
                customer.Randomize();
                Console.WriteLine("\n{0} walks by your stand.", customer.GetName());
                if (customer.WillBuy(player, weather, pitcher))
                {
                    BuyCup(player, pitcher, inventory);
                    if (customer.DetermineIfCustomerWillBuyAgain(pitcher))
                    {
                        Console.WriteLine("{0} says, 'I'll take another cup please!'", customer.GetName());
                        BuyCup(player, pitcher, inventory);
                    }
                }
            }
            else
            {
                Console.WriteLine("\nThere are no customers right now.\n");
            }
        }