RPG Crafting System
This is a simple crafting system for the GameDev.tv RPG course. This crafting system was initially inspired by the one used in Valheim.
Version 0.4
- Moved a function from Inventory to an extension method. I forgot that I was the one that added it in the first place
- Added a flag to the
CraftingTableto configure whether or not crafting can be cancelled - Added functionality to the output slot. Right-clicking the items will send it to the inventory if there is space for it. For now it's in, but I will likely turn it into opt-in functionality
Setup
Cursor Type
- Add a new entry to the
CursorTypeenum and call itCrafting - Add a new mapping to the
PlayerControllerfor thisCursorTypeand select an icon that will represent crafting
Crafting Table
- Create a crafting table prefab with a model
- Add a
SaveableEntitycomponent - Add the
CraftingTablecomponent
Crafting UI
- Add the
Crafting UIprefab to theUI Canvasgame object in theCoreprefab - Make sure all the scripts on the game object is ok. The prefab uses a script that has not been included in this package (
SaveableEntity). If the scripts is reported as 'missing' delete the component and add the correct one. In the prefab, leave theUnique Identifierfield empty. We need it to get generated for each instance of the table
TimeKeeper
- Add the
TimeKeeperprefab to theCoreprefab - Make sure all the scripts on the game object is ok. The prefab uses a script that has not been included in this package (
SaveableEntity). If the scripts is reported as 'missing' delete the component and add the correct one. In the prefab, set theUnique Identifierto something like 'timekeeper'. We need this one to always have this name
Recipes
- Make some recipes. Be sure to remove the demo recipes or it will appear in your game
Notes
- I made an extension method for the inventory system to check if an item is in the inventory and get the amount if any. It's ever so slightly less performant, but saves me from having to change the
Inventoryclass and explain here how to do it, since I can't add it to this package. - This package is dependent on the RPG course - especially the inventory system. The UI uses sprites that are included in the course and are therefore not in this package. Sprites that are not in the course were either created by myself, or modified from course images (I made a horizontal scrollbar from the vertical ones) and are included here.