Inventory Engine  v4.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MoreMountains.InventoryEngine.ItemPicker Class Reference

Add this component to an object so it can be picked and added to an inventory More...

Inherits MonoBehaviour.

Public Member Functions

virtual void ResetQuantity ()
 Resets the remaining quantity to the initial quantity More...
 
virtual void OnTriggerEnter (Collider collider)
 Triggered when something collides with the picker More...
 
virtual void OnTriggerEnter2D (Collider2D collider)
 Triggered when something collides with the picker More...
 
virtual void Pick ()
 Picks this item and adds it to its target inventory More...
 
virtual void Pick (string targetInventoryName, string playerID="Player1")
 Picks this item and adds it to the target inventory specified as a parameter More...
 
virtual bool Pickable ()
 Returns true if this item can be picked, false otherwise More...
 
virtual void FindTargetInventory (string targetInventoryName, string playerID="Player1")
 Finds the target inventory based on its name More...
 

Public Attributes

InventoryItem Item
 the item that should be picked More...
 
int Quantity = 1
 the initial quantity of that item that should be added to the inventory when picked More...
 
int RemainingQuantity = 1
 the current quantity of that item that should be added to the inventory when picked More...
 
bool PickableIfInventoryIsFull = false
 if you set this to true, a character will be able to pick this item even if its inventory is full More...
 
bool DisableObjectWhenDepleted = false
 if you set this to true, the object will be disabled when picked More...
 
bool RequirePlayerTag = true
 if this is true, this object will only be allowed to be picked by colliders with a Player tag More...
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our item picker More...
 
virtual void Initialization ()
 On Init we look for our target inventory More...
 
virtual void PickSuccess ()
 Describes what happens when the object is successfully picked More...
 
virtual void PickFail ()
 Describes what happens when the object fails to get picked (inventory full, usually) More...
 
virtual void DisableObjectIfNeeded ()
 Disables the object if needed. More...
 
virtual void DetermineMaxQuantity ()
 Determines the max quantity of item that can be picked from this More...
 

Protected Attributes

int _pickedQuantity = 0
 
Inventory _targetInventory
 

Detailed Description

Add this component to an object so it can be picked and added to an inventory

Member Function Documentation

◆ DetermineMaxQuantity()

virtual void MoreMountains.InventoryEngine.ItemPicker.DetermineMaxQuantity ( )
protectedvirtual

Determines the max quantity of item that can be picked from this

◆ DisableObjectIfNeeded()

virtual void MoreMountains.InventoryEngine.ItemPicker.DisableObjectIfNeeded ( )
protectedvirtual

Disables the object if needed.

◆ FindTargetInventory()

virtual void MoreMountains.InventoryEngine.ItemPicker.FindTargetInventory ( string  targetInventoryName,
string  playerID = "Player1" 
)
virtual

Finds the target inventory based on its name

Parameters
targetInventoryNameTarget inventory name.

◆ Initialization()

virtual void MoreMountains.InventoryEngine.ItemPicker.Initialization ( )
protectedvirtual

On Init we look for our target inventory

◆ OnTriggerEnter()

virtual void MoreMountains.InventoryEngine.ItemPicker.OnTriggerEnter ( Collider  collider)
virtual

Triggered when something collides with the picker

Parameters
colliderOther.

◆ OnTriggerEnter2D()

virtual void MoreMountains.InventoryEngine.ItemPicker.OnTriggerEnter2D ( Collider2D  collider)
virtual

Triggered when something collides with the picker

Parameters
colliderOther.

◆ Pick() [1/2]

virtual void MoreMountains.InventoryEngine.ItemPicker.Pick ( )
virtual

Picks this item and adds it to its target inventory

◆ Pick() [2/2]

virtual void MoreMountains.InventoryEngine.ItemPicker.Pick ( string  targetInventoryName,
string  playerID = "Player1" 
)
virtual

Picks this item and adds it to the target inventory specified as a parameter

Parameters
targetInventoryNameTarget inventory name.

◆ Pickable()

virtual bool MoreMountains.InventoryEngine.ItemPicker.Pickable ( )
virtual

Returns true if this item can be picked, false otherwise

◆ PickFail()

virtual void MoreMountains.InventoryEngine.ItemPicker.PickFail ( )
protectedvirtual

Describes what happens when the object fails to get picked (inventory full, usually)

◆ PickSuccess()

virtual void MoreMountains.InventoryEngine.ItemPicker.PickSuccess ( )
protectedvirtual

Describes what happens when the object is successfully picked

◆ ResetQuantity()

virtual void MoreMountains.InventoryEngine.ItemPicker.ResetQuantity ( )
virtual

Resets the remaining quantity to the initial quantity

◆ Start()

virtual void MoreMountains.InventoryEngine.ItemPicker.Start ( )
protectedvirtual

On Start we initialize our item picker

Member Data Documentation

◆ _pickedQuantity

int MoreMountains.InventoryEngine.ItemPicker._pickedQuantity = 0
protected

◆ _targetInventory

Inventory MoreMountains.InventoryEngine.ItemPicker._targetInventory
protected

◆ DisableObjectWhenDepleted

bool MoreMountains.InventoryEngine.ItemPicker.DisableObjectWhenDepleted = false

if you set this to true, the object will be disabled when picked

◆ Item

InventoryItem MoreMountains.InventoryEngine.ItemPicker.Item

the item that should be picked

◆ PickableIfInventoryIsFull

bool MoreMountains.InventoryEngine.ItemPicker.PickableIfInventoryIsFull = false

if you set this to true, a character will be able to pick this item even if its inventory is full

◆ Quantity

int MoreMountains.InventoryEngine.ItemPicker.Quantity = 1

the initial quantity of that item that should be added to the inventory when picked

◆ RemainingQuantity

int MoreMountains.InventoryEngine.ItemPicker.RemainingQuantity = 1

the current quantity of that item that should be added to the inventory when picked

◆ RequirePlayerTag

bool MoreMountains.InventoryEngine.ItemPicker.RequirePlayerTag = true

if this is true, this object will only be allowed to be picked by colliders with a Player tag


The documentation for this class was generated from the following file: