CraftingUI

CraftingUI inherits from TradeUI

CraftingUI displays all available items to craft. Crafting UI is enabled on interacting with the Crafting Bench, and it´s disabled when leaving the Crafting Bench.

CRAFTING UI

  • craftButton: Button that contains a Recipe to craft. Refer to CraftButton for more information.

  • ingredientPrefab: IngredientUIIcon that defines an ingredient for the Recipe of the highlighted CraftButton

  • ingredientContainer: Ingredients Prefabs will be instantiated inside ingredientContainer

The rest of properties are part of TradeUI.

Functions | CraftingUI.cs

UpdateSelectedUI(Recipe_SO, int amountToCraft)

Highlights the current recipe and displays information about it: Name, result, ingredients, etc...

  • recipe: Recipe_SO to display all information about.

  • amountToCraft: Amount to display on the UI. This needs to match the real amount to craft to Crafting Processes and UI are up-to-date.

UpdateIngredientDisplay(Recipe_SO, int amountToCraft)

Updates the Ingredient Displays of a highlighted Recipe based on the desired amount of items to craft.

  • recipe: Recipe_SO to display all information about.

  • amountToCraft: Amount to display on the UI. This needs to match the real amount to craft to Crafting Processes and UI are up-to-date.

UpdateCraftingProcess(CraftingProcess craftingProcess, float progress)

Updates a Recipe Button progress.

  • craftingProcess: Crafting Process to update.

  • progress: Takes values from 0 to 1.

GetCraftButton(Recipe_SO recipe)

Returns the Craft Button based on its recipe. Returns a CraftButton.

  • recipe: Among all buttons, it returns the button that contains this recipe.

GetCraftingProcess(Recipe_SO recipe)

Returns the Crafting Process based on its recipe. Returns a Crafting Process.

  • recipe: Among all Crafting Processes, it returns the one that contains this recipe.

CraftItem(Recipe_SO recipe, int craftAmount)

Starts the Crafting Process for a Recipe based on the amount to craft.

  • recipe: recipe to craft.

  • craftAmount: Amount to craft.

IsCrafting(Recipe_SO recipe)

Returns true if the passed recipe is being crafted. Returns a boolean.

  • recipe: recipe to check crafting process.

Last updated