InventoryProManager
Last updated
Last updated
The InventoryProManager is the most essential part of the Inventory System. It manages Inventory Slots, Highlighted Slots, Fav Menus, Grid Generation, Inventory Visibility & much more!
inventoryStyle: Defines the style of the Inventory & its behaviour. Grid Slots take 1 space from the Inventory (1x1 Slots only) while Tetris slots can take different sizes ( 2x1, 2x2, 3x1, 3x2, etc... )
gridGenerator: Reference to , child of the InventoryProManager.
slotRightClickEvent: Defines the behaviour when right clicking on an Inventory Slot.
None: Nothing Happens. Right click behaviour is disabled.
Drop: The Item will be dropped
ContextMenu: Context Menu appears, allowing multiple options ( Recommended )
contextMenu: If slotRightClickEvent is set to ContextMenu, this object will be enabled when right clicking on slots, allowing actions and additional functionality.
contextMenuOffset: To avoid displaying the ContextMenu exactly where the Mouse is placed, we can add a position offset (horizontal, vertical)
useFavouritesRadialMenu: If true, the Player will be able to pin favorite Items in a Radial Menu for Quick Access & usage
favItemsMenu: Reference to the , child of InventoryProManager.
storeWeaponsIfHotbarFull: If true & the hotbhar is full of weapons: Weapon will be stored in the Inventory. false & the hotbar is full of weapons: Weapon will be swapped in the hotbar for the current weapon.
interactManager: Player´s InteractManager Reference.
tooltipManager: Reference to the Tooltipo Manager.
weaponGenericPickeable: Used to Spawn Weapon Pickeables when dropped out of the Inventory.
attachmentGenericPickeable: Used to Spawn Attachment Pickeables when dropped out of the Inventory.
bulletsGenericPickeable: Used to Spawn Bullets Pickeables when dropped out of the Inventory.
itemGenericPickeable: Used to Spawn items Pickeables when dropped out of the Inventory.
closeButton: Reference to the Button that closes the Inventory on press. This action is automatically assigned.
trashButton: Reference to the Area that deletes Items from the Inventory on drop. This action is automatically assigned.
gamepadSpecificUI: UI that appears when using a Gamepad with the Inventory
highlightSlotColor: When highlighted, slots will take on a tint of this color.
availableSlotColor: When available while dragging a slot, slots will take on a tint of this color.
occupiedSlotColor: When occupied while dragging a slot, slots will take on a tint of this color.
examinationUI: UI that appears when examining an item. Check ExamineItem.cs for more information.
examinationText: Text to display examined name.
highlightItemSFX: SFX played when hovering an Inventory Slot.
rotateItemSFX: SFX Played when rotating the dragged slot ( Only for Tetris Inventory Style )
placeItemSFX: SFX Played when placing an Item on the grid.
invInputActions: Contains a Collection of Inputs that can be customized and adjusted specifically for the Inventory System.
events
_InteractManager
WeaponGenericPickeable
AttachmentGenericPickeable
BulletsGenericPickeable
ItemGenericPickeable
_InventoryStyle
UseFavouritesRadialMenu
StoreWeaponsIfHotbarFull
AvailableSlotColor
OccupiedSlotColor
_TooltipManager
_GridGenerator
_FavItemsMenu
InventorySlots
ChestSlots
HotbarSlots
TrashButton
ContextMenuClickSFX
_SlotRightClickEvent
IsInventoryOpen
IsFavRadialMenuOpen
HighlightSlot(InventorySlot slot)
Highlights/Selects a slot & enables Visual Indicators.
events: InventorySlot to highlight
OpenInventory()
Opens the Inventory & Enables UI
CloseInventory()
Closes the Inventory & Disables UI
DropOutsideInventory(InventorySlot slot)
Removes an Item from the Inventory and Instantiates a Pickeable
slot: Slot to remove.
CalculateTotalBullets(bool overrideCurrentBullets)
Re-calculates the available bullets in the inventory that can be used by weapons with limited magazines
slot: Overrides current Weapon Magazine with available bullets.
SplitOutsideInventory(InventorySlot slot)
Used by ContextMenu, separates half of the amounf of the passed slot, and drops it outside the Inventory.
slot: Slot to split.
Deleteitem(InventorySlot slot)
Deletes an item from the Inventory / Hotbar / Chest
slot: Slot to delete.
RotateItem(int rot)
For Tetris Inventories only, rotates an item. 0 & 180 degress are considered as oriented. 90 & 270 are considered not oriented.
rot: Rotation of the Slot in multiples of 90 from 0 to 360 ( 360 will be reset to 0 by default )
IsOriented()
Returns whether the currented rotation is oriented or not
SetExaminationUIVisibility(bool visible, string text)
Enables or Disables the Examination UI
visible: This boolean controls the visibility state of the Examination UI
text: Name of the examined Item
ResetHighlightedSlotsArea(Color defaultBackgroundColor, bool clearCurrentReferences)
Resets highlighted area ( Whether available or occupied ) to the default background color.
defaultBackgroundColor: Color to assign to the InventorySlots Background
clearCurrentReferences: If true, clears the highlighted slots list.
ReassignSlots(InventorySlot slot)
Helper function to reassign the slots for an item occupying multiple slots. Used by Tetris Inventories.
slot: Slot to reassign.
IsValidPosition(InventorySlot targetSlot, Vector2Int itemSize)
In a Tetris Inventory, when trying to occupy some slots from the anchor, we first need to check if the Item fits in the target slot, based on the item size, to avoid Grid overflow errors.
targetSlot: Inventory Slot at which the anchor slot will be placed
itemSize: Item Size of the Item to place at targetSlot
IsSlotOccupied(InventorySlot anchor)
Returns whether a slot is occupied or not. An item is occupied if it has a valid Anchor or Item assigned.
anchor: Ensure to pass the Anchor of the Slot you want to check if it´s occupied.
SetSlotsColors(Color color)
Overrides the background color of all slots inside highlightedSlotArea
color: Color to tint the background of the slots
contextMenuClickSFX: SFX Played when clicking on Buttons.