示例#1
0
 public void InteractionWithCustomer(int numberOfPlayers)
 {
     for (int i = 0; i < numberOfPlayers; ++i)
     {
         Console.WriteLine("Day {0}", players[i].DaysPlayed);
         for (int j = 0; j < day.Customers.Count; ++j)
         {
             if (!pitcher.IsEmpty())
             {
                 if (day.Customers[j].BuyLemonade(pitcher.Type, players[i].LemonadeStand))
                 {
                     --pitcher.CupsInPitcher;
                     players[i].CashBox.Money            += players[i].LemonadeStand.PricePerCup;
                     players[i].CashBox.Income           += players[i].LemonadeStand.PricePerCup;
                     players[i].LemonadeStand.AmountSold += 1;
                     players[i].LemonadeStand.RemoveCupsFromInventory(1, players[i].LemonadeStand.Inventory);
                 }
             }
             else
             {
                 if (players[i].CheckForPitcherIngredientsInInventory(players[i].LemonadeStand.Inventory))
                 {
                     pitcher = players[i].LemonadeStand.MakePitcher(players[i].LemonadeStand.Inventory, players[i]);
                 }
                 else
                 {
                     players[i].LemonadeStand.IsSoldOut = true;
                 }
             }
         }
         players[i].DaysPlayed += 1;
     }
 }