Class Item
Basic unit inside inventory system. ※※⚠ Use global single instance ⚠※※
Implements
Constructors
Item()
Declaration
public Item()
Properties
AllowDuplicateUpdate
True if same type of item can update multiple times during same frame for same holder
Declaration
public virtual bool AllowDuplicateUpdate { get; }
EmbedIntoLevel
True if this item can Embed into level blocks and get spawn when the block is picked. (like ore inside stone)
Declaration
public virtual bool EmbedIntoLevel { get; }
MaxStackCount
Count limitation for multiple items inside one inventory slot
Declaration
public abstract int MaxStackCount { get; }
TypeID
Unique ID for this type of item
Declaration
public int TypeID { get; init; }
Methods
BeforeItemUpdate_FromEquipment(Character)
This function is called every frame when the holder is equipping this item
Declaration
public virtual void BeforeItemUpdate_FromEquipment(Character holder)
BeforeItemUpdate_FromInventory(Character, int, int)
This function is called every frame when this item is in an holder's inventory
Declaration
public virtual void BeforeItemUpdate_FromInventory(Character holder, int inventoryID, int itemIndex)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | The holder of the inventory |
int | inventoryID | ID of the inventory |
BeforePoseAnimationUpdate_FromEquipment(PoseCharacterRenderer)
This function is called every frame when a pose-style character equipping this item
Declaration
public virtual void BeforePoseAnimationUpdate_FromEquipment(PoseCharacterRenderer rendering)
CanUse(Character)
True if this item can be use at current frame
Declaration
public virtual bool CanUse(Character holder)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | Holder that trying to use this item |
DrawItem(Entity, IRect, Color32, int)
Call this function to render the item
Declaration
public virtual void DrawItem(Entity holder, IRect rect, Color32 tint, int z)
Parameters
Type | Name | Description |
---|---|---|
Entity | holder | Holder that own this item |
IRect | rect | Rect position in global space |
Color32 | tint | Color tint |
int | z | Z value for sort rendering cells |
ItemConditionCheck(Character)
True if the item should receive update callback at current condition
Declaration
public virtual bool ItemConditionCheck(Character holder)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | Holder that own this item |
OnCharacterAttack_FromEquipment(Character, Bullet)
This function is called when the holder attack with this item equipping
Declaration
public virtual void OnCharacterAttack_FromEquipment(Character character, Bullet bullet)
Instance of the bullet entity from the attack
OnCharacterAttack_FromInventory(Character, Bullet, int, int)
This function is called when holder attacks
Declaration
public virtual void OnCharacterAttack_FromInventory(Character character, Bullet bullet, int inventoryID, int itemIndex)
Parameters
Type | Name | Description |
---|---|---|
Character | character | The inventory holder |
Bullet | bullet | Bullet entity this attack spawns |
int | inventoryID | ID of the inventory |
OnCollect(Character)
This function is called when this item get collect from ItemHolder
Declaration
public virtual void OnCollect(Character holder)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | Character that collects this item |
OnItemUpdate_FromEquipment(Character)
This function is called every frame when the holder is equipping this item
Declaration
public virtual void OnItemUpdate_FromEquipment(Character holder)
OnItemUpdate_FromInventory(Character, int, int)
This function is called every frame when this item is in an holder's inventory
Declaration
public virtual void OnItemUpdate_FromInventory(Character holder, int inventoryID, int itemIndex)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | The holder of the inventory |
int | inventoryID | ID of the inventory |
OnItemUpdate_FromItemHolder(ItemHolder, int)
This funtion is called every frame when it's being holded by a ItemHolder entity on stage
Declaration
public virtual void OnItemUpdate_FromItemHolder(ItemHolder holder, int count)
OnPoseAnimationUpdate_FromEquipment(PoseCharacterRenderer)
This function is called every frame when a pose-style character equipping this item
Declaration
public virtual void OnPoseAnimationUpdate_FromEquipment(PoseCharacterRenderer rendering)
OnPoseAnimationUpdate_FromInventory(PoseCharacterRenderer, int, int)
This function is called every frame when pose-style character update after rendering is ready
Declaration
public virtual void OnPoseAnimationUpdate_FromInventory(PoseCharacterRenderer rendering, int inventoryID, int itemIndex)
Parameters
Type | Name | Description |
---|---|---|
PoseCharacterRenderer | rendering | The inventory holder |
int | inventoryID | ID of the inventory |
OnTakeDamage_FromEquipment(Character, ref Damage)
This function is called when the holder took damage with this item equipping
Declaration
public virtual void OnTakeDamage_FromEquipment(Character holder, ref Damage damage)
OnTakeDamage_FromInventory(Character, int, int, ref Damage)
This function is called when holder take damage
Declaration
public virtual void OnTakeDamage_FromInventory(Character holder, int inventoryID, int itemIndex, ref Damage damage)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | The inventory holder |
int | inventoryID | ID of the inventory |
TryRepairEquipment(Character)
Perform a repair for this item as an equipment
Declaration
public virtual bool TryRepairEquipment(Character holder)
Use(Character, int, int, out bool)
Perform the logic when the item get used
Declaration
public virtual bool Use(Character holder, int inventoryID, int itemIndex, out bool consume)
Parameters
Type | Name | Description |
---|---|---|
Character | holder | Holder that using this item |
int | inventoryID | Inventory ID of this holder |
int | itemIndex | Index of this item inside the inventory |
bool | consume | True if the item should disappear after being used |
Returns
Type | Description |
---|---|
bool | True if the item is used |