/// <summary> /// Adds in a new crafting recipe. /// </summary> /// <param name="Name"></param> /// <param name="Recipe"></param> public void addCraftingRecipe(string Name, UnlockableCraftingRecipe Recipe) { if (this.craftingRecipes.ContainsKey(Name) == false) { this.craftingRecipes.Add(Name, Recipe); } else { throw new Exception("This crafting book already contains a recipe with the same id!"); } }
/// <summary> /// Unlocks the crating recipe so that it can be shown in the menu. /// </summary> /// <param name="Name"></param> public void unlockRecipe(string Name) { UnlockableCraftingRecipe recipe = this.getCraftingRecipe(Name); if (recipe == null) { return; } else { recipe.unlock(); } }
/// <summary> /// Checks to see if a crafting recipe has been unlocked. /// </summary> /// <param name="Name"></param> /// <returns></returns> public bool hasUnlockedCraftingRecipe(string Name) { UnlockableCraftingRecipe recipe = this.getCraftingRecipe(Name); if (recipe == null) { return(false); } else { return(recipe.hasUnlocked); } }
/// <summary> /// Adds in a crafting recipe. /// </summary> /// <param name="Name"></param> /// <param name="Recipe"></param> /// <param name="Unlocked">Is this recipe already unlocked?</param> public void addCraftingRecipe(string Name, Recipe Recipe, bool Unlocked) { UnlockableCraftingRecipe recipe = new UnlockableCraftingRecipe(this.craftingGroup, Recipe, Unlocked); this.addCraftingRecipe(Name, recipe); }