Beispiel #1
0
        public void CookPizza(Pizzeria pizzeria)
        {
            pizza = pizzeria.pizza;
            Console.WriteLine($"PizzaMaker: Готовлю пиццу {pizza}");

            pizzeria.OnGiveOrderPizzaMaker -= CookPizza;
            Thread.Sleep(1000);
            FinishCooking(pizzeria);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Pizzeria pizzeria = new Pizzeria(1000);

            List <Customer> customers = new List <Customer>()
            {
                new Customer("VLad", 600)
            };

            Console.WriteLine($"Customer: {customers[0].Name} made an order");

            if (customers[0].OrderPizza(pizzeria, TypePizze.MeatPizza))
            {
                Console.WriteLine($"Customer: {customers[0].Name} got pizza " + CheckOrder(customers[0]).Pizza.ToString());
            }
            else
            {
                Console.WriteLine($"Customer: {customers[0].Name} not enough funds");
            }


            Console.ReadKey();
        }
Beispiel #3
0
 public void BeginCookPizza(Pizzeria pizzeria)
 {
     pizzeria.OnGiveOrderPizzaMaker += CookPizza;
 }
Beispiel #4
0
 public void FinishCooking(Pizzeria pizzeria)
 {
     Console.WriteLine($"PizzaMaker: Пицца {pizzeria.pizza} готова!");
     OnFinishCooking?.Invoke(this);
 }
Beispiel #5
0
 public bool OrderPizza(Pizzeria pizzeria, TypePizze pizza)
 {
     return(pizzeria.OrderTo(pizza, ref Money, GetPizza));
 }
Beispiel #6
0
 public void PickUpOrder(Pizzeria pizzeria)
 {
     Console.WriteLine($"User: Забираю свой заказ № {pizzeria.NumberOrder} и ем {pizzeria.pizza} пиццу");
     pizzeria.OnGiveOrderUser -= PickUpOrder;
 }