コード例 #1
0
    void OnCollisionEnter(Collision other)
    {
        FinishedFood food = other.gameObject.GetComponent <FinishedFood>();

        if (food != null)
        {
            receiveOrder(food);
        }
    }
コード例 #2
0
    private int receiveOrder(FinishedFood food)
    {
        int    score = 0;
        string result;

        StartCoroutine(StartOrderAfterInputSeconds(5f));

        //If the entire food is wrong, then earn 0 points.
        if (food.foodRecipe.name != desiredDish.name)
        {
            tvText.text = "¡Esta no es mi orden!";
            GameObject.Destroy(food.gameObject);

            return(0);
        }


        else
        {
            tvText.text = "¡Gracias!";
            GameObject.Destroy(food.gameObject);

            return(10);
        }


        /*
         * //Loop through the finished food's additional ingredients, matches get bonus! If either have extras, then minus points :<
         *
         * foreach (Ingredient ingredient in food.additionalIngredients)
         * {
         *  if (desiredIngredients.Contains(ingredient.name))
         *  {
         *      score += 10;
         *      desiredIngredients.Remove(ingredient.name);
         *  }
         *
         *  else
         *  {
         *      score -= 10;
         *
         *
         *  }
         * }
         *
         * //If there are ingredients missed.
         * if (desiredIngredients.Count != 0)
         * {
         *
         *
         * }*/
    }