// Use this for initialization void Start() { gameController = GameController.instance; player = gameController.player; craftingController = CraftingController.instance; itemDatabase = ItemDatabase.instance; recipeDatabase = RecipeDatabase.instance; recipe = recipeDatabase.GetRecipe(recipeId); craftingButton = GetComponent <Button>(); craftingButton.onClick.AddListener(Craft); }
public void UnlockRecipe(int id) { RecipeInfo recipe = recipeDatabase.GetRecipe(id); if (recipe == null) { throw new System.ArgumentException("Recipe database does not have an item with id " + id); } if (unlockedRecipes.Contains(recipe)) { Debug.Log("Recipe with id " + id + " is already unlocked."); } else { unlockedRecipes.Add(recipe); if (!_unlockedRecipeIds.Contains(id)) { _unlockedRecipeIds.Add(id); } } }