private void RecalculateQuantities(RecipeDisplay recipeDisplay) { bool canCraft = inventory.CanPickup(recipeDisplay.Result.Item); recipeDisplay.Result.TextColor = canCraft ? availableColor : notAvailableColor; foreach (var ingredient in recipeDisplay.Ingredients) { var sufficientQuantity = inventory.SufficientQuantity(ingredient.Item); ingredient.TextColor = sufficientQuantity ? availableColor : notAvailableColor; canCraft &= sufficientQuantity; } recipeDisplay.CanCraft = canCraft; }
// Use this for initialization void Start() { recipeDisplay = FindObjectOfType <RecipeDisplay>(); recipe = new List <RecipeItem>(); GenerateRecipe(); }