Exemple #1
0
        private void OnCollisionEnter(Collision collision)
        {
            if (this.ingredient == null && collision.gameObject.CompareTag("RecipeIngredient"))
            {
                this.GetComponent <InteractableObject>().MaterialTintOverride = Color.red;
                if (gameObject.transform.position.y < collision.transform.position.y)
                {
                    print(gameObject.name + " is below " + collision.gameObject.name);

                    this.ingredient = collision.gameObject;


                    RecipeItemObject recipeInteraction = this.ingredient.GetComponent <RecipeItemObject>();
                    recipeInteraction.optionalPlate = this.gameObject;


                    if (!this.ingredient.name.Contains("bottomBun"))
                    {
                        InteractableObject interactableObject = this.GetComponent <InteractableObject>();
                        interactableObject.MaterialTintOverride = Color.red;
                    }
                    else if (this.ingredient.name.Contains("bottomBun"))
                    {
                        InteractableObject interactableObject = this.GetComponent <InteractableObject>();
                        interactableObject.MaterialTintOverride = Color.blue;
                    }
                }
            }
        }
Exemple #2
0
 private void OnCollisionExit(Collision collision)
 {
     if (collision.gameObject.CompareTag("RecipeIngredient"))
     {
         this.GetComponent <InteractableObject>().MaterialTintOverride = null;
         if (this.ingredient == collision.gameObject)
         {
             print(this.ingredient.name + " is no longer above " + this.gameObject.name);
             RecipeItemObject recipeInteraction = this.ingredient.GetComponent <RecipeItemObject>();
             recipeInteraction.stopCookingIngredient();
             this.ingredient = null;
         }
     }
 }
Exemple #3
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.CompareTag("RecipeIngredient"))
     {
         this.GetComponent <InteractableObject>().MaterialTintOverride = Color.red;
         if (gameObject.transform.position.y < collision.transform.position.y)
         {
             print(gameObject.name + " is below " + collision.gameObject.name);
             this.ingredient = collision.gameObject;
             RecipeItemObject recipeInteraction = this.ingredient.GetComponent <RecipeItemObject>();
             recipeInteraction.startCookingIngredient();
         }
     }
 }
Exemple #4
0
        private bool validateBurger(GameObject recipeItem, int index, List <string> recipe)
        {
            if (index >= recipe.Count)
            {
                return(true);
            }
            if (recipeItem == null)
            {
                return(false);
            }
            if (recipe[index] != recipeItem.name)
            {
                return(false);
            }
            RecipeItemObject recipeInteraction = recipeItem.GetComponent <RecipeItemObject>();

            return(validateBurger(recipeInteraction.objectAbove, index + 1, recipe));
        }
Exemple #5
0
    private GameObject validateBurger(GameObject recipeItem, GameObject plate, int index, List <string> recipe)
    {
        if (index < 0)
        {
            return(plate);
        }
        if (recipeItem == null)
        {
            return(null);
        }
        print("Item on stack is " + recipeItem.name);
        if (!recipeItem.name.Contains(recipe[index]))
        {
            return(null);
        }

        RecipeItemObject recipeInteraction = recipeItem.GetComponent <RecipeItemObject>();

        return(validateBurger(recipeInteraction.objectBelow, recipeInteraction.optionalPlate, index - 1, recipe));
    }