Exemplo n.º 1
0
    private List <RecipeItem> GenerateRecipe()
    {
        if (recipe.Count > 0)
        {
            recipe.Clear();
        }

        List <GameObject> unusedIngredients = ingredients.ToList();

        if (difficultyLevel > (difficultyLevels.Count - 1))
        {
            difficultyLevel = difficultyLevels.Count - 1;
        }

        int foodleft = difficultyLevels[difficultyLevel];

        while (foodleft > 0)
        {
            GameObject currentIngredient = unusedIngredients[Random.Range(0, unusedIngredients.Count)];

            int amount = Random.Range(1, 2 + foodleft / 2);

            recipe.Add(new RecipeItem(currentIngredient, amount));

            foodleft -= amount;

            unusedIngredients.Remove(currentIngredient);
        }
        recipeDisplay.DisplayRecipe(recipe);
        Cannon.instance.AssembleAmmunitionList();
        return(recipe);
    }
Exemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        GenerateRecipe();

        foreach (RecipeComponent c in theRecipe.components)
        {
            Debug.Log("Ingredient: " + c.ingredient + " Equation: " + c.equation);
        }

        recipeDisplay.SetRecipe(theRecipe);
        recipeDisplay.DisplayRecipe();
        recipeDisplay.HighlightCurrentComponent(theRecipe.currentIngrIndex);

        cauldron.SetRecipe(theRecipe);
        //cauldron.SetManager(this);
    }