예제 #1
0
 public void SalesLogic(Player playerOne, Inventory playerInventory, Customer customerPerson)
 {
     if (playerInventory.FilledCups > 0)
     {
         CustomerBuy(playerOne, playerInventory, customerPerson);
     }
     else if (playerInventory.CanFillPitcher() && playerInventory.FilledCups == 0)
     {
         playerInventory.FillAPitcher();
         CustomerBuy(playerOne, playerInventory, customerPerson);
     }
     else
     {
         Console.WriteLine("No Lemonade to Sell!");
     }
 }
예제 #2
0
        public void CreateCustomers(Player playerOne, Inventory playerInventory, Customer customer, int spawnNumber)
        {
            if (playerInventory.CanFillPitcher())
            {
                playerInventory.FillAPitcher();
            }
            else
            {
                Console.WriteLine("You have no Lemonade to sell!");
            }
            Random rng = new Random();

            for (int i = 0; i < spawnNumber; i++)
            {
                switch (rng.Next(1, 5))
                {
                case 1:
                    customer = new OldWoman();
                    SetTolerance(customer, playerInventory);
                    SalesLogic(playerOne, playerInventory, customer);
                    customer = null;
                    break;

                case 2:
                    customer = new YoungMan();
                    SetTolerance(customer, playerInventory);
                    SalesLogic(playerOne, playerInventory, customer);
                    customer = null;
                    break;

                case 3:
                    customer = new Child();
                    SetTolerance(customer, playerInventory);
                    SalesLogic(playerOne, playerInventory, customer);
                    customer = null;
                    break;

                case 4:
                    customer = new Alien();
                    SetTolerance(customer, playerInventory);
                    SalesLogic(playerOne, playerInventory, customer);
                    customer = null;
                    break;
                }
                System.Threading.Thread.Sleep(10);
            }
        }