Пример #1
0
 /// <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!");
     }
 }
Пример #2
0
        /// <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();
            }
        }
Пример #3
0
        /// <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);
            }
        }
Пример #4
0
        /// <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);
        }