public bool AddTopping(Topping topping)
 {
     if (CanAddMoreTopping() && !DoesToppingExist(topping, true))
     {
         ToppingList.Add(topping);
         System.Console.WriteLine("added topping: " + topping.Type);
         return(true);
     }
     return(false);
 }
        // protected abstract void AddCrust(Crust crust);
        // protected abstract void AddSize(Size size);
        public void AddDefaultToppings()
        {
            foreach (var topType in DefaultToppings)
            {
                // System.Console.WriteLine("topType:" + topType);
                // float price = PriceManager.Instance.getPrice(topType);
                // ToppingList.Add(new Topping(topType) { Price = price });
                ToppingList.Add(new Topping(topType));

                // foreach (var toppingObject in toppingPriceList)
                // {
                //     if (toppingObject.Type == topType)
                //     {
                //         ToppingList.Add(toppingObject);
                //         break;
                //     }
                // }
            }
        }
Example #3
0
        // protected abstract void AddCrust(Crust crust);
        // protected abstract void AddSize(Size size);
        protected void AddDefaultToppings()
        {
            foreach (var topType in DefaultToppings)
            {
                float price = PriceManager.Instance.getPrice(topType);
                ToppingList.Add(new Topping(topType)
                {
                    Price = price
                });

                // foreach (var toppingObject in toppingPriceList)
                // {
                //     if (toppingObject.Type == topType)
                //     {
                //         ToppingList.Add(toppingObject);
                //         break;
                //     }
                // }
            }
        }
Example #4
0
 public void AddTopping(Topping topping)
 {
     ToppingList.Add(topping);
 }