public override void BuildBurger() { Random rnd = new Random(); int randomMaxMeats = rnd.Next(_maxItems[0]); for (int i = 0; i < randomMaxMeats; i++) { int randMeat = rnd.Next(3); switch (randMeat) { case 0: Beef b = new Beef { Weight = rnd.NextDouble() * rnd.Next(5), Name = "говядина" }; Burger.AddMeat(b); Console.WriteLine("Добавили говядины"); MoneyCounter.LogBuyes(b); break; case 1: Ham h = new Ham { Weight = rnd.NextDouble() * rnd.Next(5), Name = "ветчина" }; Burger.AddMeat(h); Console.WriteLine("Добавили ветчины"); MoneyCounter.LogBuyes(h); break; case 2: Sausage s = new Sausage { Weight = rnd.NextDouble() * rnd.Next(5), Name = "сосиска" }; Burger.AddMeat(s); Console.WriteLine("Добавили сосиску"); MoneyCounter.LogBuyes(s); break; } Thread.Sleep(40); } int randomMaxVegetables = rnd.Next(_maxItems[1]); for (int i = 0; i < randomMaxVegetables; i++) { int randVegetable = rnd.Next(3); switch (randVegetable) { case 0: Vegetable Tomato = new Vegetable() { Weight = rnd.NextDouble(), VegetableType = TypeOfVegetable.Tomato, Name = "красный помидор" }; Burger.AddVegetable(Tomato); Console.WriteLine("Добавили красного помидора"); MoneyCounter.LogBuyes(Tomato); break; case 1: Vegetable Onion = new Vegetable() { Weight = rnd.NextDouble(), VegetableType = TypeOfVegetable.Onion, Name = "лук репчатый" }; Burger.AddVegetable(Onion); Console.WriteLine("Добавили лука репчатого"); MoneyCounter.LogBuyes(Onion); break; case 2: Vegetable Cucumber = new Vegetable() { Weight = rnd.NextDouble(), VegetableType = TypeOfVegetable.Cucumber, Name = "соленый огурчик" }; Burger.AddVegetable(Cucumber); Console.WriteLine("Добавили соленого огурчика"); MoneyCounter.LogBuyes(Cucumber); break; } Thread.Sleep(40); } int randomMaxCheeseSlices = rnd.Next(_maxItems[2]); for (int i = 0; i < randomMaxCheeseSlices; i++) { MoneyCounter.LogBuyes(Burger.AddCheeseSlice()); Thread.Sleep(40); } Console.WriteLine("Ура ваш бургер был собран"); }
public CheeseSlice AddCheeseSlice() => Burger.AddCheeseSlice();