Class ItemComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.items.ItemComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionItemComponent
(String itemName, ItemType itemType, int price, String texturePath) Constructor for ItemItemComponent
(String itemName, ItemType itemType, String texturePath) Constructor for ItemItemComponent
(String itemName, ItemType itemType, String itemDescription, int price, String texturePath) Constructor for ItemItemComponent
(String itemName, ItemType itemType, String itemDescription, String texturePath) Constructor for Item -
Method Summary
Modifier and TypeMethodDescriptionReturns the description of the itemReturns the id of the itemReturns the name of the itemcom.badlogic.gdx.graphics.Texture
Returns the type of the itemint
getPrice()
Returns the price of the itemboolean
Returns if the item is consumableboolean
Returns selalble bool of itemvoid
setItemDescription
(String description) Sets the price of the itemvoid
setItemName
(String name) Sets the item name of the itemvoid
setItemTexture
(String texturePath) Sets an Item's texture component to a given Texturevoid
setPrice
(int price) Sets the price of the itemMethods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
-
Constructor Details
-
ItemComponent
Constructor for Item- Parameters:
itemName
- user facing name for itemitemType
- the enum for type of itemtexturePath
- path for the item texture
-
ItemComponent
Constructor for Item- Parameters:
itemName
- user facing nameitemType
- the enum for type of itemprice
- sellable price of the itemtexturePath
- path for the item texture
-
ItemComponent
public ItemComponent(String itemName, ItemType itemType, String itemDescription, String texturePath) Constructor for Item- Parameters:
itemName
- user facing name for itemitemType
- the enum for type of itemitemDescription
- user facing description for itemtexturePath
- path for the item texture
-
ItemComponent
public ItemComponent(String itemName, ItemType itemType, String itemDescription, int price, String texturePath) Constructor for Item- Parameters:
itemName
- user facing name for itemitemType
- the enum for type of itemitemDescription
- user facing description for itemprice
- price of itemtexturePath
- path for the item texture
-
-
Method Details
-
isPerishable
public boolean isPerishable()Returns if the item is consumable- Returns:
- boolean whether the item is perishable or not
-
getPrice
public int getPrice()Returns the price of the item- Returns:
- int price of item
-
setPrice
public void setPrice(int price) Sets the price of the item- Parameters:
price
- int price of item
-
getItemTexture
public com.badlogic.gdx.graphics.Texture getItemTexture()- Returns:
- the texture of the item (Primarily used to the inventory display)
-
setItemTexture
Sets an Item's texture component to a given Texture- Parameters:
texturePath
- - path of the new item texture
-
isSellable
public boolean isSellable()Returns selalble bool of item- Returns:
- true if item is sellable, false otherwise
-
getItemName
Returns the name of the item- Returns:
- int price of item
-
setItemName
Sets the item name of the item- Parameters:
name
- string name of the item
-
getItemId
Returns the id of the item- Returns:
- String id of item
-
getItemDescription
Returns the description of the item- Returns:
- String description of item
-
setItemDescription
Sets the price of the item- Parameters:
description
- string description of the item
-
getItemType
Returns the type of the item- Returns:
- ItemType enum type of item
-