Class ItemComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.items.ItemComponent
- Direct Known Subclasses:
IngredientComponent
,MealComponent
,PlateComponent
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionItemComponent
(String itemName, ItemType itemType, int weight) Called when the item is created and initates necessary variables -
Method Summary
Modifier and TypeMethodDescriptionGets the id of the itemGets the name of the itemGets the type of the itemReturns the path to the texture for this ItemComponent.int
Gets the weight of the itemMethods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
ItemComponent
Called when the item is created and initates necessary variables- Parameters:
itemName
- - a string which is the name of the itemitemType
- - an ItemType which is the type of the itemweight
- - an intger which is the weight of the item
-
-
Method Details
-
getItemId
Gets the id of the item- Returns:
- a string which is the randomly generated id of the item
-
getItemName
Gets the name of the item- Returns:
- a string which is the name of the item
-
getWeight
public int getWeight()Gets the weight of the item- Returns:
- a string which is the weight of the item
-
getItemType
Gets the type of the item- Returns:
- an itemType which is the type the items is
-
getTexturePath
Returns the path to the texture for this ItemComponent.- Returns:
- a String which is the path to the image of the parent entity's TextureRenderComponent. If this component does not have a parent entity, returns null
-