コード例 #1
0
    /// <summary>
    /// Combine ingredients and return the result
    /// </summary>
    /// <param name="foods"></param>
    /// <param name="method"></param>
    /// <returns></returns>
    public Ingredient CombineIngredients(List<Ingredient> foods, PrepMethod method)
    {
        Ingredient newIngredient;
        Combination former = new Combination(foods, method);
        Combination combo = combinations.FirstOrDefault(c => c.Equals(former));
        if(combo == null)
        {
            newIngredient = failure;
        }
        else
        {
            newIngredient = combo.product;
        }

        //Clear that list of ingredients
        //  but derpily keep them around for checks
        foreach(var food in foods)
        {
            food.ClearAll();
            food.transform.SetParent(transform);
        }

        newIngredient = GameObject.Instantiate(newIngredient);
        newIngredient.formingCombination = former;
        return newIngredient;
    }
コード例 #2
0
 public Combination(List<Ingredient> ingredients, PrepMethod method)
 {
     this.ingredients = ingredients;
     this.method = method;
 }
コード例 #3
0
 public Ingredient CombineIngredients(Ingredient ingredient, PrepMethod method)
 {
     var lIngredients = new List<Ingredient>() { ingredient };
     return CombineIngredients(lIngredients, method);
 }