Corgi Engine v9.4
Loading...
Searching...
No Matches
MoreMountains.InventoryEngine.InventoryItem Class Reference

Base class for inventory items, meant to be extended. Will handle base properties and drop spawn. More...

Inheritance diagram for MoreMountains.InventoryEngine.InventoryItem:
MoreMountains.CorgiEngine.InventoryEngineHealth MoreMountains.CorgiEngine.InventoryEngineKey MoreMountains.CorgiEngine.InventoryEnginePoints MoreMountains.CorgiEngine.InventoryEngineTimeModifier MoreMountains.CorgiEngine.InventoryEngineWeapon MoreMountains.InventoryEngine.ArmorItem MoreMountains.InventoryEngine.BaseItem MoreMountains.InventoryEngine.BombItem MoreMountains.InventoryEngine.HealthBonusItem MoreMountains.InventoryEngine.WeaponItem

Public Member Functions

virtual Inventory TargetInventory (string playerID)
 Gets the target inventory.
virtual Inventory TargetEquipmentInventory (string playerID)
 Gets the target equipment inventory.
virtual InventoryItem Copy ()
 Copies an item into a new one.
virtual GameObject SpawnPrefab (string playerID)
 Spawns the associated prefab.
virtual bool Pick (string playerID)
 What happens when the object is picked - override this to add your own behaviors.
virtual bool Use (string playerID)
 What happens when the object is used - override this to add your own behaviors.
virtual bool Equip (string playerID)
 What happens when the object is equipped - override this to add your own behaviors.
virtual bool UnEquip (string playerID)
 What happens when the object is unequipped (called when dropped) - override this to add your own behaviors.
virtual void Swap (string playerID)
 What happens when the object gets swapped for another object.
virtual bool Drop (string playerID)
 What happens when the object is dropped - override this to add your own behaviors.

Static Public Member Functions

static bool IsNull (InventoryItem item)
 Determines if an item is null or not.

Public Attributes

string ItemID
 the (unique) ID of the item
string TargetInventoryName = "MainInventory"
 the inventory name into which this item will be stored
bool ForceSlotIndex = false
 if this is true, the item won't be added anywhere's there's room in the inventory, but instead at the specified TargetIndex slot
int TargetIndex = 0
 if ForceSlotIndex is true, this is the index at which the item will be added in the target inventory
bool Usable = false
 whether or not this item can be "used" (via the Use method) - important, this is only the INITIAL state of this object, IsUsable is to be used anytime after that
bool Consumable = true
 if this is true, calling Use on that object will consume one unit of it
int ConsumeQuantity = 1
 if this item is consumable, determines how many will be consumed per use (usually one)
bool Equippable = false
 whether or not this item can be equipped - important, this is only the INITIAL state of this object, IsEquippable is to be used anytime after that
bool EquippableIfInventoryIsFull = true
 whether or not this item can be equipped if its target inventory is full
bool MoveWhenEquipped = true
 if this is true, this item will be removed from its original inventory when equipped, and moved to its EquipmentInventory
bool Droppable = true
 if this is true, this item can be dropped
bool CanMoveObject = true
 if this is true, objects can be moved
bool CanSwapObject = true
 if this is true, objects can be swapped with another object
InventoryItemDisplayProperties DisplayProperties
 a set of properties defining whether or not to show inventory action buttons when that item is selected
int Quantity = 1
 the base quantity of this item
string ItemName
 the name of the item - will be displayed in the details panel
string ShortDescription
 the item's short description to display in the details panel
string Description
 the item's long description to display in the details panel
Sprite Icon
 the icon that will be shown on the inventory's slot
GameObject Prefab
 the prefab to instantiate when the item is dropped
bool ForcePrefabDropQuantity = false
 if this is true, the quantity of the object will be forced to PrefabDropQuantity when dropped
int PrefabDropQuantity = 1
 the quantity to force on the spawned item if ForcePrefabDropQuantity is true
MMSpawnAroundProperties DropProperties
 the minimal distance at which the object should be spawned when dropped
int MaximumStack = 1
 If this object can be stacked (multiple instances in a single inventory slot), you can specify here the maximum size of that stack.
int MaximumQuantity = 999999999
 the maximum quantity allowed of this item in the target inventory
ItemClasses ItemClass
 the class of the item
string TargetEquipmentInventoryName
 If this item is equippable, you can set here its target inventory name (for example ArmorInventory). Of course you'll need an inventory with a matching name in your scene.
AudioClip EquippedSound
 the sound the item should play when equipped (optional)
AudioClip UsedSound
 If this item can be used, you can set here a sound to play when it gets used, if you don't a default sound will be played.
AudioClip MovedSound
 the sound the item should play when moved (optional)
AudioClip DroppedSound
 the sound the item should play when dropped (optional)
bool UseDefaultSoundsIfNull = true
 if this is set to false, default sounds won't be used and no sound will be played

Protected Attributes

Inventory _targetInventory = null
Inventory _targetEquipmentInventory = null

Properties

virtual bool IsUsable [get]
 whether or not this object can be used
virtual bool IsEquippable [get]
 whether or not this object can be equipped

Detailed Description

Base class for inventory items, meant to be extended. Will handle base properties and drop spawn.

Member Function Documentation

◆ Copy()

virtual InventoryItem MoreMountains.InventoryEngine.InventoryItem.Copy ( )
virtual

Copies an item into a new one.

◆ Drop()

virtual bool MoreMountains.InventoryEngine.InventoryItem.Drop ( string playerID)
virtual

What happens when the object is dropped - override this to add your own behaviors.

◆ Equip()

virtual bool MoreMountains.InventoryEngine.InventoryItem.Equip ( string playerID)
virtual

What happens when the object is equipped - override this to add your own behaviors.

Reimplemented in MoreMountains.CorgiEngine.InventoryEngineWeapon, MoreMountains.InventoryEngine.ArmorItem, and MoreMountains.InventoryEngine.WeaponItem.

◆ IsNull()

bool MoreMountains.InventoryEngine.InventoryItem.IsNull ( InventoryItem item)
static

Determines if an item is null or not.

Returns
true if is null the specified item; otherwise, false.
Parameters
itemItem.

◆ Pick()

virtual bool MoreMountains.InventoryEngine.InventoryItem.Pick ( string playerID)
virtual

What happens when the object is picked - override this to add your own behaviors.

Reimplemented in MoreMountains.CorgiEngine.InventoryEnginePoints.

◆ SpawnPrefab()

virtual GameObject MoreMountains.InventoryEngine.InventoryItem.SpawnPrefab ( string playerID)
virtual

Spawns the associated prefab.

◆ Swap()

virtual void MoreMountains.InventoryEngine.InventoryItem.Swap ( string playerID)
virtual

What happens when the object gets swapped for another object.

◆ TargetEquipmentInventory()

virtual Inventory MoreMountains.InventoryEngine.InventoryItem.TargetEquipmentInventory ( string playerID)
virtual

Gets the target equipment inventory.

The target equipment inventory.

◆ TargetInventory()

virtual Inventory MoreMountains.InventoryEngine.InventoryItem.TargetInventory ( string playerID)
virtual

Gets the target inventory.

The target inventory.

◆ UnEquip()

virtual bool MoreMountains.InventoryEngine.InventoryItem.UnEquip ( string playerID)
virtual

What happens when the object is unequipped (called when dropped) - override this to add your own behaviors.

Reimplemented in MoreMountains.CorgiEngine.InventoryEngineWeapon, MoreMountains.InventoryEngine.ArmorItem, and MoreMountains.InventoryEngine.WeaponItem.

◆ Use()

virtual bool MoreMountains.InventoryEngine.InventoryItem.Use ( string playerID)
virtual

Member Data Documentation

◆ _targetEquipmentInventory

Inventory MoreMountains.InventoryEngine.InventoryItem._targetEquipmentInventory = null
protected

◆ _targetInventory

Inventory MoreMountains.InventoryEngine.InventoryItem._targetInventory = null
protected

◆ CanMoveObject

bool MoreMountains.InventoryEngine.InventoryItem.CanMoveObject = true

if this is true, objects can be moved

◆ CanSwapObject

bool MoreMountains.InventoryEngine.InventoryItem.CanSwapObject = true

if this is true, objects can be swapped with another object

◆ Consumable

bool MoreMountains.InventoryEngine.InventoryItem.Consumable = true

if this is true, calling Use on that object will consume one unit of it

◆ ConsumeQuantity

int MoreMountains.InventoryEngine.InventoryItem.ConsumeQuantity = 1

if this item is consumable, determines how many will be consumed per use (usually one)

◆ Description

string MoreMountains.InventoryEngine.InventoryItem.Description

the item's long description to display in the details panel

◆ DisplayProperties

InventoryItemDisplayProperties MoreMountains.InventoryEngine.InventoryItem.DisplayProperties

a set of properties defining whether or not to show inventory action buttons when that item is selected

◆ Droppable

bool MoreMountains.InventoryEngine.InventoryItem.Droppable = true

if this is true, this item can be dropped

◆ DroppedSound

AudioClip MoreMountains.InventoryEngine.InventoryItem.DroppedSound

the sound the item should play when dropped (optional)

◆ DropProperties

MMSpawnAroundProperties MoreMountains.InventoryEngine.InventoryItem.DropProperties

the minimal distance at which the object should be spawned when dropped

◆ Equippable

bool MoreMountains.InventoryEngine.InventoryItem.Equippable = false

whether or not this item can be equipped - important, this is only the INITIAL state of this object, IsEquippable is to be used anytime after that

◆ EquippableIfInventoryIsFull

bool MoreMountains.InventoryEngine.InventoryItem.EquippableIfInventoryIsFull = true

whether or not this item can be equipped if its target inventory is full

◆ EquippedSound

AudioClip MoreMountains.InventoryEngine.InventoryItem.EquippedSound

the sound the item should play when equipped (optional)

◆ ForcePrefabDropQuantity

bool MoreMountains.InventoryEngine.InventoryItem.ForcePrefabDropQuantity = false

if this is true, the quantity of the object will be forced to PrefabDropQuantity when dropped

◆ ForceSlotIndex

bool MoreMountains.InventoryEngine.InventoryItem.ForceSlotIndex = false

if this is true, the item won't be added anywhere's there's room in the inventory, but instead at the specified TargetIndex slot

◆ Icon

Sprite MoreMountains.InventoryEngine.InventoryItem.Icon

the icon that will be shown on the inventory's slot

◆ ItemClass

ItemClasses MoreMountains.InventoryEngine.InventoryItem.ItemClass

the class of the item

◆ ItemID

string MoreMountains.InventoryEngine.InventoryItem.ItemID

the (unique) ID of the item

◆ ItemName

string MoreMountains.InventoryEngine.InventoryItem.ItemName

the name of the item - will be displayed in the details panel

◆ MaximumQuantity

int MoreMountains.InventoryEngine.InventoryItem.MaximumQuantity = 999999999

the maximum quantity allowed of this item in the target inventory

◆ MaximumStack

int MoreMountains.InventoryEngine.InventoryItem.MaximumStack = 1

If this object can be stacked (multiple instances in a single inventory slot), you can specify here the maximum size of that stack.

◆ MovedSound

AudioClip MoreMountains.InventoryEngine.InventoryItem.MovedSound

the sound the item should play when moved (optional)

◆ MoveWhenEquipped

bool MoreMountains.InventoryEngine.InventoryItem.MoveWhenEquipped = true

if this is true, this item will be removed from its original inventory when equipped, and moved to its EquipmentInventory

◆ Prefab

GameObject MoreMountains.InventoryEngine.InventoryItem.Prefab

the prefab to instantiate when the item is dropped

◆ PrefabDropQuantity

int MoreMountains.InventoryEngine.InventoryItem.PrefabDropQuantity = 1

the quantity to force on the spawned item if ForcePrefabDropQuantity is true

◆ Quantity

int MoreMountains.InventoryEngine.InventoryItem.Quantity = 1

the base quantity of this item

◆ ShortDescription

string MoreMountains.InventoryEngine.InventoryItem.ShortDescription

the item's short description to display in the details panel

◆ TargetEquipmentInventoryName

string MoreMountains.InventoryEngine.InventoryItem.TargetEquipmentInventoryName

If this item is equippable, you can set here its target inventory name (for example ArmorInventory). Of course you'll need an inventory with a matching name in your scene.

◆ TargetIndex

int MoreMountains.InventoryEngine.InventoryItem.TargetIndex = 0

if ForceSlotIndex is true, this is the index at which the item will be added in the target inventory

◆ TargetInventoryName

string MoreMountains.InventoryEngine.InventoryItem.TargetInventoryName = "MainInventory"

the inventory name into which this item will be stored

◆ Usable

bool MoreMountains.InventoryEngine.InventoryItem.Usable = false

whether or not this item can be "used" (via the Use method) - important, this is only the INITIAL state of this object, IsUsable is to be used anytime after that

◆ UseDefaultSoundsIfNull

bool MoreMountains.InventoryEngine.InventoryItem.UseDefaultSoundsIfNull = true

if this is set to false, default sounds won't be used and no sound will be played

◆ UsedSound

AudioClip MoreMountains.InventoryEngine.InventoryItem.UsedSound

If this item can be used, you can set here a sound to play when it gets used, if you don't a default sound will be played.

Property Documentation

◆ IsEquippable

virtual bool MoreMountains.InventoryEngine.InventoryItem.IsEquippable
get

whether or not this object can be equipped

◆ IsUsable

virtual bool MoreMountains.InventoryEngine.InventoryItem.IsUsable
get

whether or not this object can be used


The documentation for this class was generated from the following file:
  • Assets/CorgiEngine/ThirdParty/MoreMountains/InventoryEngine/InventoryEngine/Scripts/Core/InventoryItem.cs