FCV Engine 0.1
A tool and framework for tutorials in game development
Loading...
Searching...
No Matches
Inventory Class Reference

Component that holds all picked up items for player. More...

Inheritance diagram for Inventory:

Public Member Functions

void TryAddItem (string itemName, Item item)
 Tries to add item to inventory and if name already exists does nothing.
 
bool TryRemoveItem (string itemName)
 Tries to remove item using item name.
 
bool HasItem (string itemName)
 Checks if inventory has the item name specified.
 

Properties

Dictionary< string, ItemInventoryItems = new() [get, set]
 Dictionary that holds all items with their names as key.
 

Detailed Description

Component that holds all picked up items for player.

Definition at line 9 of file Inventory.cs.

Member Function Documentation

◆ HasItem()

bool HasItem ( string itemName)

Checks if inventory has the item name specified.

Parameters
itemNamename of item
Returns
returns true if item exists, false if not

Definition at line 45 of file Inventory.cs.

◆ TryAddItem()

void TryAddItem ( string itemName,
Item item )

Tries to add item to inventory and if name already exists does nothing.

Parameters
itemNamename of item
itemItem class reference

Definition at line 26 of file Inventory.cs.

◆ TryRemoveItem()

bool TryRemoveItem ( string itemName)

Tries to remove item using item name.

Parameters
itemNamename of item
Returns
Returns true if item was removed, false if not

Definition at line 36 of file Inventory.cs.


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