C# 클래스 InventoryData, 2DPlatformer

상속: MonoBehaviour
파일 보기 프로젝트 열기: MarbleGameDev/2DPlatformer 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
equippedItem int
gold int
itemCount int>.Dictionary
items List

공개 메소드들

메소드 설명
AddItem ( object name, int number ) : void

Used to add items to the inventory

Attack ( ) : float

Returns the float attack value of the equipped item

Awake ( ) : void
Cooldown ( ) : float

Returns the cooldown/swingSpeed attribute of the equipped item

DropItem ( object obj ) : void

Executes the Drop() method on the object passed if it exists in the inventory

GetItem ( string name ) : object

Returns the item object from the inventory matching the name passed, defaulting to null

HasItem ( object obj ) : bool

Returns boolean whether the object passed exists in the inventory

Range ( ) : float

Returns the range attribute of the equipped item

RemoveItem ( object name, int number ) : bool

Used to remove items from the inventory, returning a boolean value of the successfulness

RemoveItem ( string name, int number ) : bool
ResetInv ( ) : void

Clears all inventory data, then saves to disk

UpdateInv ( ) : void
UseItem ( object obj ) : void

Executes the Use() method on the object passed if it exits in the inventory

addGold ( int amount ) : void

Adds the integer amount to the player's gold quantity

compareItems ( object obj1, object obj2 ) : bool
equipItem ( object obj ) : void

Equips the object passed if it exists in the inventory

getEquipped ( ) : object

Returns the currently equipped item, defaulting to Hands

hasEnoughGold ( int amount ) : bool

Returns whether the player has more than the amount specified of gold

removeGold ( int amount ) : bool

Removes the integer amount from the player's gold if possible, doing nothing if not, returning a boolean value of it's success

비공개 메소드들

메소드 설명
AddObject ( object obj, int number ) : void

Used internally to deal with adding objects to the necessary lists and dictionaries

GetInventory ( ) : void

Retrieves data from the stored data in the Json file

SaveInventory ( ) : void

Saves data in the Json file save object, then writes the data to file

메소드 상세

AddItem() 공개 정적인 메소드

Used to add items to the inventory
public static AddItem ( object name, int number ) : void
name object
number int
리턴 void

Attack() 공개 정적인 메소드

Returns the float attack value of the equipped item
public static Attack ( ) : float
리턴 float

Awake() 공개 정적인 메소드

public static Awake ( ) : void
리턴 void

Cooldown() 공개 정적인 메소드

Returns the cooldown/swingSpeed attribute of the equipped item
public static Cooldown ( ) : float
리턴 float

DropItem() 공개 정적인 메소드

Executes the Drop() method on the object passed if it exists in the inventory
public static DropItem ( object obj ) : void
obj object
리턴 void

GetItem() 공개 정적인 메소드

Returns the item object from the inventory matching the name passed, defaulting to null
public static GetItem ( string name ) : object
name string
리턴 object

HasItem() 공개 정적인 메소드

Returns boolean whether the object passed exists in the inventory
public static HasItem ( object obj ) : bool
obj object
리턴 bool

Range() 공개 정적인 메소드

Returns the range attribute of the equipped item
public static Range ( ) : float
리턴 float

RemoveItem() 공개 정적인 메소드

Used to remove items from the inventory, returning a boolean value of the successfulness
public static RemoveItem ( object name, int number ) : bool
name object
number int
리턴 bool

RemoveItem() 공개 정적인 메소드

public static RemoveItem ( string name, int number ) : bool
name string
number int
리턴 bool

ResetInv() 공개 정적인 메소드

Clears all inventory data, then saves to disk
public static ResetInv ( ) : void
리턴 void

UpdateInv() 공개 정적인 메소드

public static UpdateInv ( ) : void
리턴 void

UseItem() 공개 정적인 메소드

Executes the Use() method on the object passed if it exits in the inventory
public static UseItem ( object obj ) : void
obj object
리턴 void

addGold() 공개 정적인 메소드

Adds the integer amount to the player's gold quantity
public static addGold ( int amount ) : void
amount int
리턴 void

compareItems() 공개 정적인 메소드

public static compareItems ( object obj1, object obj2 ) : bool
obj1 object
obj2 object
리턴 bool

equipItem() 공개 정적인 메소드

Equips the object passed if it exists in the inventory
public static equipItem ( object obj ) : void
obj object
리턴 void

getEquipped() 공개 정적인 메소드

Returns the currently equipped item, defaulting to Hands
public static getEquipped ( ) : object
리턴 object

hasEnoughGold() 공개 정적인 메소드

Returns whether the player has more than the amount specified of gold
public static hasEnoughGold ( int amount ) : bool
amount int
리턴 bool

removeGold() 공개 정적인 메소드

Removes the integer amount from the player's gold if possible, doing nothing if not, returning a boolean value of it's success
public static removeGold ( int amount ) : bool
amount int
리턴 bool

프로퍼티 상세

equippedItem 공개적으로 정적으로 프로퍼티

public static int equippedItem
리턴 int

gold 공개적으로 정적으로 프로퍼티

public static int gold
리턴 int

itemCount 공개적으로 정적으로 프로퍼티

public static Dictionary itemCount
리턴 int>.Dictionary

items 공개적으로 정적으로 프로퍼티

public static List items
리턴 List