Ejemplo n.º 1
0
    //check for lid, everything else after ingredients have snapped
    public void LateUpdate()
    {
        //on mouseup, check for ingredients
        if (Input.GetMouseButtonUp(0))
        {
            this.hasLid = false;
            foreach (Transform child in this.transform)
            {
                if (child.name == "Lid")
                {
                    this.hasLid = true;
                }
                else if (child.name == "Sleeve")
                {
                    this.hasSleeve = true;
                }
            }

            //look through the ingredients and modify the drink accordingly
            if (!ingredients.IsEmpty())
            {
                foreach (string itemName in ingredients.Enumerate())
                {
                    if (itemName.Contains("milk"))
                    {
                        drink.AddMilk(itemName);
                    }
                    else if (itemName.Equals("blended"))
                    {
                        Fill();
                        drink.AddBlended();
                    }
                    else if (itemName.Contains("coffee"))
                    {
                        drink.AddCoffee(itemName);
                        Fill();
                    }
                    else if (itemName.Contains("ice"))
                    {
                        drink.AddIce();
                    }
                }
            }
            //then clear the list
            ingredients.ClearIngredients();
        }
    }