public static SerializedRecipeInformation ConvertFrom(RecipeInformation recipeInformation) { return(new SerializedRecipeInformation { Type = (int)recipeInformation.Type, RequiredIngredients = recipeInformation.RequiredIngredients.Select(ri => (int)ri).ToList(), DepthDifficulty = recipeInformation.DepthDifficulty, Category = recipeInformation.Category, RestrictedTools = recipeInformation.RestrictedTools.Select(rt => (int)rt).ToList(), RandomizeDifficulty = recipeInformation.RandomizeDifficulty, Quantity = recipeInformation.Quantity }); }
private void DecideOnAnIngredient(RecipeInformation recipeInformation, TechType forType) { var existingIngredient = _recipes.RecipesByType[(int)forType].Ingredients.Where(i => i.TechType == (int)recipeInformation.Type).FirstOrDefault(); if (existingIngredient != null) { existingIngredient.Amount++; } else { _recipes.RecipesByType[(int)forType].Ingredients.Add(new GeneratedRecipeIngredient { Amount = 1, TechType = (int)recipeInformation.Type }); } }