Class InventoryElement
An inventory element in the InventoryPanel that a cursor can highlight and select
Inheritance
Namespace: WeaverCore.Inventory
Assembly: WeaverCore.dll
Syntax
public abstract class InventoryElement : MonoBehaviour
Properties
| Edit this page View SourceCursorOffset
Used to determine the offset of the cursor when highlighting this inventory element. By default, it uses the offset of the Collider attached to this element
Declaration
public virtual Vector2 CursorOffset { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
CursorPos
Used to determine where the cursor should be located when highlighting this inventory element
Declaration
public virtual Vector3 CursorPos { get; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
CursorSize
Used to determine the size of the cursor when highlighting this inventory element. By default, it uses the bounds of the Collider attached to this element
Declaration
public virtual Vector2 CursorSize { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Highlightable
Can this inventory element be highlighted by the cursor?
Declaration
public virtual bool Highlightable { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MainPanel
Declaration
public InventoryPanel MainPanel { get; }
Property Value
| Type | Description |
|---|---|
| InventoryPanel |
Selectable
Can the player click on this inventory element?
Declaration
public virtual bool Selectable { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceNavigateTo(MoveDirection)
Called when the player wants to move to a nearby element. For example, if the player wants to move up in the UI, this function specifies which element the player will go to next
Declaration
public abstract InventoryElement NavigateTo(InventoryElement.MoveDirection move)
Parameters
| Type | Name | Description |
|---|---|---|
| InventoryElement.MoveDirection | move | The movement direction the player is going in |
Returns
| Type | Description |
|---|---|
| InventoryElement | The next element to move to, or null if there is no element to move to |
OnClick()
Called when the player clicks on this element. Selectable must be set to true for this to trigger
Declaration
public virtual void OnClick()
OnHighlight()
Called when the inventory element is highlighted
Declaration
public virtual void OnHighlight()
OnUnHighlight()
Called when the inventory element is no longer highlighted
Declaration
public virtual void OnUnHighlight()