Skip to content

Inventory System

IsaacMulcahy edited this page Feb 22, 2024 · 1 revision

Overview

The inventory system is made up of a few components and is designed to be quick to use and customise.

Slot

A 'slot' within the inventory system is used to define where an item when carried is shown and provides some limitations around what can go into the slot. These should be attached to the agent, ideally to the skeleton objects so they move with animations. This should not be interacted with directly unless on setup.

Properties

Name Description
itemSizeSlot Sets the maximum size of the object
allowSmaller Allows for items smaller than the maximum to be added
carriedItem Reference to the Item being carried (do not set this, this is handled by the system)
isUsingSlot If the slot is for when the agent is using the item (i.e. a hand would be true for this)
total The total in this slot of the item

Slot Manager

The Slot Manager is is part of the agents AI Databoard and on start of the application will find of instances of the 'Slot' component of the children objects and create an array of them. This system has a number of functions which handles all the slots, this have been surfaced on the AI Databoard by some functions.

AI Databoard Functions

Name Description
PickUpItem(item) Used to pick up an item
DestoryCurrentItemInUsingSlot() Deletes the item in the first Using Slot in the list
ConsumeItem(ITEMS enum) Will lower the 'total' count of a slot with the ITEMS enum which matches, if the total reaches '0' it will delete the 'item'
DropItem(ITEMS enum) Drop an entry from the slot which matches the ITEMS, if there is more than one in the slot it'll spawn in a copy
Clone this wiki locally