C# Class SunsetHigh.Inventory

Represents an assortment of items; each Character has an Inventory to hold his/her own collection
Inheritance: IEnumerable
Afficher le fichier Open project: ErraticUnicorn/MOSH

Méthodes publiques

Свойство Type Description
NUM_TYPE_ITEMS int

Méthodes publiques

Méthode Description
GetEnumerator ( ) : IEnumerator
Inventory ( ) : System

Default constructor

addItem ( System.Item type ) : void

Adds one item of a given type to this Inventory

addItem ( System.Item type, int quantity ) : void

Adds a given number of the given Item type to this Inventory

getSaveStructure ( ) : InventorySave

Used for saving purposes only

hasItem ( ) : bool

Checks if this Inventory has at least one item

hasItem ( System.Item item ) : bool

Checks if this Inventory has the given Item type

loadSaveStructure ( InventorySave saveStruct ) : void

Used for loading in the hero's inventory when restoring a saved game

numItem ( System.Item item ) : int

Gets the amount of a specific Item type in this Inventory

numTotalItems ( ) : int

Sum total of all the items in this Inventory

removeAll ( ) : void

Clears this Inventory of all items

removeItem ( System.Item type ) : void

Removes one item of a given type from this Inventory

removeItem ( System.Item type, int quantity ) : void

Removes a given number of the given item type from this Inventory

removeRandomItem ( ) : System.Item

Removes and returns a random item from this Inventory; each Item type is weighted equally (i.e. quantity does not matter); use this for pickpocketing

Private Methods

Méthode Description
pushEvent ( InventoryEventArgs e ) : void

Method Details

GetEnumerator() public méthode

public GetEnumerator ( ) : IEnumerator
Résultat IEnumerator

Inventory() public méthode

Default constructor
public Inventory ( ) : System
Résultat System

addItem() public méthode

Adds one item of a given type to this Inventory
public addItem ( System.Item type ) : void
type System.Item The Item type to add
Résultat void

addItem() public méthode

Adds a given number of the given Item type to this Inventory
public addItem ( System.Item type, int quantity ) : void
type System.Item The Item type to add
quantity int The number of items to add
Résultat void

getSaveStructure() public méthode

Used for saving purposes only
public getSaveStructure ( ) : InventorySave
Résultat InventorySave

hasItem() public méthode

Checks if this Inventory has at least one item
public hasItem ( ) : bool
Résultat bool

hasItem() public méthode

Checks if this Inventory has the given Item type
public hasItem ( System.Item item ) : bool
item System.Item The Item type to check for
Résultat bool

loadSaveStructure() public méthode

Used for loading in the hero's inventory when restoring a saved game
public loadSaveStructure ( InventorySave saveStruct ) : void
saveStruct InventorySave An int[] representation of inventory to load
Résultat void

numItem() public méthode

Gets the amount of a specific Item type in this Inventory
public numItem ( System.Item item ) : int
item System.Item The Item type to check for
Résultat int

numTotalItems() public méthode

Sum total of all the items in this Inventory
public numTotalItems ( ) : int
Résultat int

removeAll() public méthode

Clears this Inventory of all items
public removeAll ( ) : void
Résultat void

removeItem() public méthode

Removes one item of a given type from this Inventory
public removeItem ( System.Item type ) : void
type System.Item The Item type to remove
Résultat void

removeItem() public méthode

Removes a given number of the given item type from this Inventory
public removeItem ( System.Item type, int quantity ) : void
type System.Item The Item type to remove
quantity int The number of items to remove
Résultat void

removeRandomItem() public méthode

Removes and returns a random item from this Inventory; each Item type is weighted equally (i.e. quantity does not matter); use this for pickpocketing
public removeRandomItem ( ) : System.Item
Résultat System.Item

Property Details

NUM_TYPE_ITEMS public_oe static_oe property

public static int NUM_TYPE_ITEMS
Résultat int