public void PickPizzas(Kitchen kitchen) { int pizzaCnt = Rand.rand.Next(1, 4); while (pizzaCnt-- != 0) { Pizza pizza; while (!kitchen.CanMake(pizza = PizzaLoader.RandomPizza())) { ; } AddPizza(pizza); } }
public void RePickPizzas(Kitchen kitchen, Pizza _pizza) { for (int i = 0; i < wantOrder.Count; i++) { if (wantOrder[i].Name == _pizza.Name) { wantOrder[i] = PizzaLoader.RandomPizza(); int cnt = 0; while (!kitchen.CanMake(wantOrder[i] = PizzaLoader.RandomPizza())) { if (++cnt > 1000) { wantOrder[i] = PizzaLoader.Fokacha(); break; } } } } }