public void AddRecipeIngredientsForSpawning(SO_Recipe recipe) { foreach (var ingredientPreparationMethod in recipe.IngredientsList) { AddIngredientToSpawnable(ingredientPreparationMethod.Ingredient); } }
private void UpdateDishStatus() { // Checking if the dish is prepared int numberOfIngredientsInPot = 0; SO_Recipe recipeOfDishBeingPrepared = _CurrentDishBeingCooked.DishRecipe; foreach (var recipeInstruction in recipeOfDishBeingPrepared.IngredientsList) { foreach (var cookedIngredient in DishesBeingPrepared[_CurrentDishBeingCooked]) { if (cookedIngredient == recipeInstruction) { ++numberOfIngredientsInPot; break; } } } _NumberOfIngredientsInPlace = numberOfIngredientsInPot; _DishCookedEvent.Invoke(_CookingPotOwner.ViewID); if (numberOfIngredientsInPot == recipeOfDishBeingPrepared.IngredientsList.Length) { ++_DishesCooked; _DishHasBeenCookedEvent.Invoke(); // Checking if there are more dishes to be prepared and changing the pointer if (_IndexOfCurrentDishBeingPrepared + 2 < DishesBeingPrepared.Count) { ++_IndexOfCurrentDishBeingPrepared; _CurrentDishBeingCooked = DishesBeingPrepared.ElementAt(_IndexOfCurrentDishBeingPrepared).Key; } else { // Player has completed all the dishes _DishesCompletedEvent.Invoke(_CookingPotOwner.ViewID); } } }