Loading...
Searching...
No Matches
AdventureCore.ItemSlot< T > Class Template Referenceabstract

Detailed Description

generic base class for item slots, slots are used to equip items
the protected equip(T) and unequip(T) are most important for equipment behaviour
for example a helmet item on an amor slot may instantiate some visual and add a modifier to the characters defense in equip, in unequip it would destroy the visual and remove the modifier
canEquip can be overridden to define whether a specific item can be equipped at the moment, applyVisibility is used when a slot is hidden(like weapons being hidden while pulling a lever)

Template Parameters
T
Type Constraints
T :ItemBase 
Inheritance diagram for AdventureCore.ItemSlot< T >:
AdventureCore.ItemSlotBase

Public Member Functions

override void Initialize (CharacterBase character)
 
override bool CanEquip (InventoryItem inventoryItem, bool clear=true)
 checks if an inventory item can be equipped
 
override void Equip (InventoryItem inventoryItem)
 equips an inventory item(if another item is already equipped it is unequipped first)
 
override void Clear ()
 clears the slot of its currently equipped item
 
- Public Member Functions inherited from AdventureCore.ItemSlotBase
virtual bool CanEquipPrevious (bool clear=true)
 checks if the slot can switch its equipped item to the previous one in its characters inventory
 
virtual bool EquipPrevious (bool clear=true)
 equips the previous item in its characters inventory
 
virtual bool CanEquipNext (bool clear=true)
 checks if the slot can switch its equipped item to the next one in its characters inventory
 
virtual bool EquipNext (bool clear=true)
 equips the next item in its characters inventory
 
virtual bool CanClear ()
 checks whether the slot can be cleared of its equipped items
 
virtual void Show ()
 shows the slot if it was hidden before
 
virtual void Hide ()
 hides the slot
 
virtual bool CanUse (int quantity=1)
 checks if the equipped item can be used
 
virtual void Use (int quantity=1)
 uses the equipped item
 

Public Attributes

FallbackItem
 
- Public Attributes inherited from AdventureCore.ItemSlotBase
string Key
 
ItemSlotCategory Category
 
int Index
 

Protected Member Functions

override void onIsHiddenChanged ()
 
virtual bool canEquip (T item)
 
virtual void equip (T item)
 
virtual void unequip (T item)
 
virtual void applyVisibility ()
 
- Protected Member Functions inherited from AdventureCore.ItemSlotBase
virtual InventoryItem getPrevious (bool clear=true)
 
virtual InventoryItem getNext (bool clear=true)
 
virtual void onEquippedInventoryItemChanged ()
 
virtual void onIsInUseChanged ()
 

Properties

EquippedItem [get]
 
override Type ItemType [get]
 
- Properties inherited from AdventureCore.ItemSlotBase
virtual InventoryItem EquippedInventoryItem [get]
 
bool IsHidden [get]
 
virtual bool IsInUse [get, set]
 
Type ItemType [get]
 
CharacterBase Character [get]
 

Additional Inherited Members

- Events inherited from AdventureCore.ItemSlotBase
Action< bool > IsInUseChanged
 
Action< bool > IsHiddenChanged
 
Action< InventoryItemEquippedInventoryItemChanged
 

Member Function Documentation

◆ CanEquip()

override bool AdventureCore.ItemSlot< T >.CanEquip ( InventoryItem inventoryItem,
bool clear = true )
inlinevirtual

checks if an inventory item can be equipped

Parameters
inventoryItemthe inventory item to equip
clearwhether clearing the slot by equipping null is valid
Returns
true if the item can be equipped

Reimplemented from AdventureCore.ItemSlotBase.

◆ Clear()

override void AdventureCore.ItemSlot< T >.Clear ( )
inlinevirtual

clears the slot of its currently equipped item

Reimplemented from AdventureCore.ItemSlotBase.

◆ Equip()

override void AdventureCore.ItemSlot< T >.Equip ( InventoryItem inventoryItem)
inlinevirtual

equips an inventory item(if another item is already equipped it is unequipped first)

Parameters
inventoryItemthe inventory item to equip

Reimplemented from AdventureCore.ItemSlotBase.

◆ Initialize()

override void AdventureCore.ItemSlot< T >.Initialize ( CharacterBase character)
inlinevirtual

Reimplemented from AdventureCore.ItemSlotBase.

◆ onIsHiddenChanged()

override void AdventureCore.ItemSlot< T >.onIsHiddenChanged ( )
inlineprotectedvirtual

Reimplemented from AdventureCore.ItemSlotBase.