BoxManager

v4.0

The BoxManager does not have to be a box! It is a thing which holds displayable inventory. This could be a treasure box, or the top of a table, or something else entirely, non physical.

In the Party Based RPG demo game, there are BoxManager components on the Lucky Large Treasure Box and Small Treasure Box -- both are in-game objects the player can walk up to and interact with.

There are also BoxManager components on Lucky Treasure Box and Small Box Button -- both of which are UI buttons the player can click on, as a demo.

BoxManagers do not have to be physical things in the world!

Required data

Inventory Panel

This is the Prefab with a Panel on it. Note in the example, which is a prefab you can find in Party Based RPG demo game, I've named the prefab descriptively, including "75px" which refers to the size of the grid boxes -- 75 pixels instead of 100.

Options

CanRemoveQuestItems and CanReceiveQuestItems deal with GameItemObjects which are marked as questItem in the Items module. In some cases, you may not want these special items to be put into certain boxes, where they may become lost from the player.

By default, quest items can be removed, but can not be placed into a BoxManager.

Public Methods

Add a GameItemObject to the list

The BoxManager has a GameItemObjectList inventoryItems on it, which holds the GameItemObjects in the box.

AddGameItemObjectToList() will attempt to add a provided GameItemObject to that list. It will return true if successful, otherwise false. Usually false would mean the item can't fit in the box.

public bool AddGameItemObjectToList(GameItemObject gameItemObject)

Open Inventory

You can override this method.

This is a method that "opens" the BoxManager inventory. You can override it if you'd like to do anything special at this point.

public virtual void OpenInventory()

// Example from TreasureBox.cs in the Party Based RPG demo game, which has
// it's own BoxManager component.
_boxManager.OpenInventory();

Last updated