Ingredient and Recipe System - thisismatthew/Bottled GitHub Wiki

Ingredients

Are created when a Pickupable script is applied to a game object. Ingredients can be picked up, placed and added into the cauldron.

Picking up/Dropping

Interactable object's will have colliders around them so when they collide with the player they will be add to a list of interactable objects for the player. When the the interaction key (currently E) is pressed the list is searched and the closest object that's in front of the player will be picked up. Pressing the interaction key again will then release the picked up object. Only objects that are tagged as ingredients will be accepted by the cauldron and non ingredient items should be spat out of the cauldron so they can still be used to fulfil there purpose within the game world.

Recipes

A recipe is a list of 3 ingredients that can be made by selecting any 3 desired ingredients from the dropdown box in the inspector. Similarly, each recipe has a list of attributes which will be given to the player in the event of the player completing the recipe. Each recipe will need to be add to cauldron by dragging the recipe into the inspector and adding it to the list of recipes, this allows each cauldron to be unique and let designers choose where players can make each potion.

Cauldron

When an ingredient is dropped into the cauldron it will delete the game object, increase the counter of ingredients in the cauldron and add it to the list of ingredients in the form of a recipe that is attached to the cauldron as a component. When the counter gets to 3

  • ingredients will be compared with all the listed recipes attached to the cauldron
  • The inside of the cauldron will change colour
  • Distributer will be emptied and loaded with applicable attributes
  • Recipe in progress will be cleared and counter reduced to 0
  • Respawn the ingredients

Distributor

The distributor is a list of attributes that can be given to the player when activated, when this is done it should remove all of the current attributes the player has and replace them with those of the new potion. If the player isn't making a new potion but has used up all of there old potion they can also return to the distributor refill there previous potion. The distributer is activated when the player goes within a certain area near the caldron which triggers a collision collider which will send forth a ladle that will follow the character and fill them up once it gets close enough. The distributor will have its contents switched out when ever a new recipe is made within the cauldron.