private static void MakeTopping(string[] data) { ToppingType type = ToppingType.Meat; decimal weight = decimal.Parse(data[2]); switch (data[1].ToLower()) { case "cheese": type = ToppingType.Cheese; break; case "sauce": type = ToppingType.Sauce; break; case "veggies": type = ToppingType.Veggies; break; case "meat": break; default: throw new ArgumentException($"Cannot place {data[1]} on top of your pizza."); } Topping topping = new Topping(type, weight); pizza.AddTopping(topping); //Console.WriteLine("{0:f2}", topping.Calories); }
public static ITopping CreateTopping(ToppingType type) { return(type switch { ToppingType.BlackOlives => new BlackOlives(), ToppingType.Pineapple => new Pineapple(), _ => null });
public IceCream(BaseType baseType, ScoopsType scoopsType, ToppingType toppingType) { var iceCreamBase = new NSUrlQueryItem("Base", baseType.ToString()); var iceCreamScoops = new NSUrlQueryItem("Scoops", scoopsType.ToString()); var iceCreamTopping = new NSUrlQueryItem("Topping", toppingType.ToString()); CheckQueryItems(new[] { iceCreamBase, iceCreamScoops, iceCreamTopping }); }
private void SetType(string input) { try { this.topitnType = Enum.Parse <ToppingType>(input, true); } catch (Exception) { throw new ArgumentException( string.Format(ErrorMessage.InvalidToppingType, input)); } }
public void Test_ToppingType(float expected, ToppingType type) { // arrange var sut = new Topping(type); // var expected = 0.6F; // act -- part that we want to test var actual = sut.Price; // assert Assert.Equal(expected, actual); }
public Topping(string toppingType, double weight) { try { this.toppingType = (ToppingType)Enum.Parse(typeof(ToppingType), toppingType, true); } catch (Exception e) { Console.WriteLine($"Cannot place {toppingType} on top of your pizza."); throw; } this.Weight = weight; this.calories = this.weight * 2; }
private void OnCollisionEnter2D(Collision2D other) { Item item = other.gameObject.GetComponent <Item>(); if (item != null) { if (other.collider.tag == "Sugar") { if (item.GetItemType() == ItemType.Item_SUGAR) { IncreaseSugar(); Destroy(other.gameObject); audio.Play(); } } else if (other.collider.tag == "Milk") { if (item.GetItemType() == ItemType.Item_MILK) { SetMilkType(item.GetMilkType()); Destroy(other.gameObject); audio.Play(); } } else if (other.collider.tag == "Flavor") { if (item.GetItemType() == ItemType.Item_FLAVOR_SHOT) { SetFlavorShot(item.GetFlavorShot()); Destroy(other.gameObject); audio.Play(); } } else if (other.collider.tag == "Topping") { if (item.GetItemType() == ItemType.Item_TOPPING) { ToppingType tt = item.GetToppingType(); if (!toppings.Contains(tt)) { toppings.Add(tt); } Destroy(other.gameObject); audio.Play(); } } } }
/** * @brief Unlocks a certain item * @param itemType The type of item to unlock * @param item The index of the item that will be unlocked, must cast enum to int */ public void UnlockItem(ItemType itemType, int item) { switch (itemType) { case ItemType.Item_BEAN: BeanType beanType = (BeanType)item; if (unlockedBeans.ContainsKey(beanType)) { unlockedBeans[beanType] = true; justUnlockedText.text = "Unlocked: " + BeanTypeToString(beanType); } break; case ItemType.Item_MILK: MilkType milkType = (MilkType)item; if (unlockedMilk.ContainsKey(milkType)) { unlockedMilk[milkType] = true; justUnlockedText.text = "Unlocked: " + MilkTypeToString(milkType); } break; case ItemType.Item_FLAVOR_SHOT: FlavorShot f = (FlavorShot)item; if (unlockedFlavors.ContainsKey(f)) { unlockedFlavors[f] = true; justUnlockedText.text = "Unlocked: " + FlavorTypeToString(f); } break; case ItemType.Item_TOPPING: ToppingType t = (ToppingType)item; if (unlockedToppings.ContainsKey(t)) { unlockedToppings[t] = true; justUnlockedText.text = "Unlocked: " + ToppingTypeToString(t); } break; default: break; } }
public override IPizza GetPizza(ToppingType tType) { IPizza currentPizza; switch (tType) { case ToppingType.Cheese: IPizza cheeseZa = new CheesePizza(); currentPizza = cheeseZa; return(currentPizza); case ToppingType.Pepperoni: IPizza pepZa = new CheesePizza(); pepZa = new Pepperoni(pepZa); currentPizza = pepZa; return(currentPizza); case ToppingType.Sausage: IPizza sausageZa = new CheesePizza(); sausageZa = new Sausage(sausageZa); currentPizza = sausageZa; return(currentPizza); case ToppingType.Supreme: IPizza supremeZa = new CheesePizza(); supremeZa = new Supreme(supremeZa); currentPizza = supremeZa; return(currentPizza); case ToppingType.BbqChicken: IPizza bbqZa = new CheesePizza(); bbqZa = new BBQChicken(bbqZa); currentPizza = bbqZa; return(currentPizza); case ToppingType.Margherita: IPizza margZa = new CheesePizza(); margZa = new Margherita(margZa); currentPizza = margZa; return(currentPizza); } return(null); }
public IPasta GetPasta(ToppingType type, IPasta pasta) { IPasta pastaPlain = new Pasta(); switch (type) { case ToppingType.Sauce: pasta = new WithSauce(pasta); return(pasta); case ToppingType.Meatball: pasta = new WithMeatball(pasta); return(pasta); case ToppingType.Cheese: pasta = new WithCheese(pasta); return(pasta); } return(pasta); }
public string ToppingTypeToString(ToppingType tt) { string s = ""; switch (tt) { case ToppingType.Topping_CINNAMON: s = "cinnamon"; break; //case ToppingType.Topping_COCOA_POWDER: //s = "cocoa powder"; //break; case ToppingType.Topping_MARSHMALLOW: s = "marshmallow"; break; case ToppingType.Topping_SPRINKLES: s = "sprinkles"; break; case ToppingType.Topping_WHIPPED_CREAM: s = "whipped cream"; break; case ToppingType.Topping_NONE: s = "no topping"; break; default: s = "unknown"; break; } return(s); }
public double CalculateCalories() { double modifier = 0; switch (ToppingType.ToLower()) { case "meat": modifier = 1.2; break; case "veggies": modifier = 0.8; break; case "cheese": modifier = 1.1; break; case "sauce": modifier = 0.9; break; } return(Weight * defaultModifier * modifier); }
public abstract IPizza GetPizza(ToppingType tType);
public Topping(int quantity, ToppingType type) { this.Quantity = quantity; this.Type = type; }
public Topping(Item item, ToppingType type) : base(item.ItemId, item.Name, item.Price, item.ImageUrl, item.ItemType) { Type = type; }
public abstract IPasta GetPasta(ToppingType topping);
public Topping(ToppingType type, decimal weight) { Type = type; Weight = weight; Calories = CalcCalories(); }
public void SetToppingType(ToppingType topping) { toppingType = topping; }
/// <summary> /// Removes topping from pizza. Regular amount unless modified /// </summary> /// <param name="topping"></param> public void RemoveTopping(ToppingType topping) { Toppings[(int)topping] = Amount.No; }
/// <summary> /// Adds topping to pizza. Regular amount unless modified /// </summary> /// <param name="topping"></param> /// <param name="a"></param> public void AddTopping(ToppingType topping, Amount a = Amount.Regular) { Toppings[(int)topping] = a; }
public void updateToppingType(int TTID, ToppingType s) { throw new NotImplementedException(); }
public void AddTopping(ToppingType topping) { toppings.Add(topping); }
public Topping(ToppingType type) : base(type.ToString()) { Type = type; }
public void addToppingType(ToppingType d) { throw new NotImplementedException(); }