Ejemplo n.º 1
0
    public void AddIngredient(Recipes.eIngredients ingredient)
    {
        particlesBurst.Play();
        particles.Play();

        for (int i = 0; i < MAX_INGREDIENTS; i++)
        {
            if(inPot[i] == Recipes.eIngredients.empty)
            {
                inPot[i] = ingredient;
                break;
            }
            if (i == MAX_INGREDIENTS - 1)
            {
                if (!CheckRecipes())
                {
                    EmptyCookingPlace(true);
                }
                AddIngredient(ingredient);
            }
        }

        if(inPot[0] != Recipes.eIngredients.empty)
        {
            effect.transform.localScale = new Vector3(3.7f, 0.5f, 3.7f);
        }

        //Audio
        GameObject.Find("Game").GetComponent<PlaySounds>().playSplash();
        GetComponent<AudioSource>().volume = 0.5f;
        if (!GetComponent<AudioSource>().isPlaying)
            GetComponent<AudioSource>().PlayDelayed(.6f);
    }
Ejemplo n.º 2
0
    public void PleaseDontForgetToInitMe(int boardX, int boardY, Recipes.eIngredients ingredientType)
    {
        this.boardX         = boardX;
        this.boardY         = boardY;
        this.ingredientType = ingredientType;

        wait = false;
        tile = Game.BOARD.GetTile(boardX, boardY);
    }
Ejemplo n.º 3
0
 private int CountIngredient(Recipes.eIngredients elem, Recipes.eIngredients[] arr)
 {
     int c = 0;
     for(int i = 0; i < arr.Length; i++)
     {
         if(arr[i] == elem)
         {
             c++;
         }
     }
     return c;
 }
Ejemplo n.º 4
0
 private bool FitsRecipe(Recipes.Recipe recipe)
 {
     Recipes.eIngredients[] recipeIngr = new Recipes.eIngredients[3];
     recipeIngr[0] = recipe.ingredient1;
     recipeIngr[1] = recipe.ingredient2;
     recipeIngr[2] = recipe.ingredient3;
     foreach (Recipes.eIngredients ingr in inPot)
     {
         if (CountIngredient(ingr, recipeIngr) != CountIngredient(ingr, inPot))
         {
             return false;
         }
     }
     return true;
 }