private void Update() { /// <summary> /// Espresso /// </summary> /// <returns></returns> if (Input.GetKeyDown(KeyCode.E)) {//Default Espress ICoffee coff = new CoffeeEspresso(); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } if (Input.GetKeyDown(KeyCode.R)) {//Espress w/milk ICoffee coff = new MilkDecorator(new CoffeeEspresso()); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } if (Input.GetKeyDown(KeyCode.T)) {//Espress w/choc ICoffee coff = new ChocolateDecorator(new CoffeeEspresso()); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } if (Input.GetKeyDown(KeyCode.Y)) {//Espress w/choc & Milk ICoffee coff = new ChocolateDecorator(new MilkDecorator(new CoffeeEspresso())); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } /// <summary> /// Filtered /// </summary> /// <returns></returns> if (Input.GetKeyDown(KeyCode.F)) {//Default Filtered ICoffee coff = new CoffeeFiltered(); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } if (Input.GetKeyDown(KeyCode.G)) {//Filtered w/milk ICoffee coff = new MilkDecorator(new CoffeeFiltered()); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } if (Input.GetKeyDown(KeyCode.H)) {//Filtered w/choc ICoffee coff = new ChocolateDecorator(new CoffeeFiltered()); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } if (Input.GetKeyDown(KeyCode.J)) {//Filtered w/Milk & choc ICoffee coff = new MilkDecorator(new ChocolateDecorator(new CoffeeFiltered())); Debug.Log("New " + coff.GetDescription() + " Cost: " + coff.GetCost().ToString()); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.A)) { ICoffee coffee = new Espresso(); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.S)) { ICoffee coffee = new Filtered(); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.D)) { ICoffee coffee = new ChocolateDecorator(new Espresso()); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.F)) { ICoffee coffee = new ChocolateDecorator(new Filtered()); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.Z)) { ICoffee coffee = new MilkDecorator(new Espresso()); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.X)) { ICoffee coffee = new MilkDecorator(new Filtered()); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.C)) { ICoffee coffee = new ChocolateDecorator(new MilkDecorator(new Filtered())); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } if (Input.GetKeyDown(KeyCode.V)) { ICoffee coffee = new ChocolateDecorator(new MilkDecorator(new Espresso())); Debug.Log("Coffee discription and cost: " + coffee.GetDescription() + " $" + coffee.GetCost()); } }