Пример #1
0
 public Italian()
 {
     Ingridients.Add("cheese");
     Ingridients.Add("tomatos");
     Ingridients.Add("olives");
     Ingridients.Add("meat");
 }
        public PizzaDecorator(Pizza pizza, params IIngridient[] addedIngrids)
        {
            _pizza      = pizza;
            Ingridients = _pizza.Ingridients.GetRange(0, _pizza.Ingridients.Count);
            foreach (var ingrid in addedIngrids)
            {
                _ingridient = ingrid;
                if (_ingridient.GetType() == typeof(CakeLayer))
                {
                    throw new  ArgumentException("Нельзя добавить второй корж");
                }
                Ingridients.Add(_ingridient.GetType());
                if (Ingridients.Count % 7 == 0)
                {
                    discount *= 0.9;
                }

                _addedCost        += _ingridient.GetCost();
                _addedDescription += $" {_ingridient.GetDescription()} + ";
            }
        }
Пример #3
0
 public Carbonara()
 {
     Ingridients.Add("cheese");
     Ingridients.Add("tomatos");
 }
Пример #4
0
 public Margarita()
 {
     Ingridients.Add("cheese");
     Ingridients.Add("tomatos");
     Ingridients.Add("olives");
 }
Пример #5
0
 public void Add(Vegetable vegetable)
 {
     Ingridients.Add(vegetable);
 }
Пример #6
0
 public Pepperoni()
 {
     Ingridients.Add("cheese");
     Ingridients.Add("tomatos");
     Ingridients.Add("meat");
 }