/// <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; }
public Combination(List<Ingredient> ingredients, PrepMethod method) { this.ingredients = ingredients; this.method = method; }
public Ingredient CombineIngredients(Ingredient ingredient, PrepMethod method) { var lIngredients = new List<Ingredient>() { ingredient }; return CombineIngredients(lIngredients, method); }