Class IngredientComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.items.ItemComponent
com.csse3200.game.components.items.IngredientComponent
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionIngredientComponent
(String itemName, ItemType itemType, int weight, int cookTime, int chopTime, String itemState) Constructs an IngredientComponent with the specified attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
burnItem()
Set the item state to burnedvoid
chopItem()
Set the item state to choppedvoid
cookItem()
Set the item state to cookedint
Returns the chop time valueint
Returns the cook time valueboolean
Returns whether the ingredient can be choppedboolean
Returns whether the ingredient can be cookedReturns the Item statevoid
rawItem()
Set the item state to rawvoid
setItemState
(String itemState) Methods inherited from class com.csse3200.game.components.items.ItemComponent
getItemId, getItemName, getItemType, getTexturePath, getWeight
Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
IngredientComponent
public IngredientComponent(String itemName, ItemType itemType, int weight, int cookTime, int chopTime, String itemState) Constructs an IngredientComponent with the specified attributes. Initialises the required variables, determining specific actions that can be used on an ingredient.- Parameters:
itemName
- - a string which is the name of the ingredientitemType
- - an ItemType which is the type of the itemweight
- - an integer which is the weight of the ingredientcookTime
- - an integer which is the time taken to cook the itemchopTime
- - an integer which is the time taken to chop the itemitemState
- - a string which is the current state of the item
-
-
Method Details
-
getCookTime
public int getCookTime()Returns the cook time value- Returns:
- an integer which is the required cook time
-
getChopTime
public int getChopTime()Returns the chop time value- Returns:
- an integer which is the required chop time
-
getItemState
Returns the Item state- Returns:
- a string which is the current state of the item
-
getIsCookable
public boolean getIsCookable()Returns whether the ingredient can be cooked- Returns:
- a boolean that indicates whether an ingredient can be cooked
-
getIsChoppable
public boolean getIsChoppable()Returns whether the ingredient can be chopped- Returns:
- a boolean that indicates whether an ingredient can be chopped
-
cookItem
public void cookItem()Set the item state to cooked -
burnItem
public void burnItem()Set the item state to burned -
chopItem
public void chopItem()Set the item state to chopped -
setItemState
-
rawItem
public void rawItem()Set the item state to raw
-