Class PlantMouseHoverComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.plants.PlantMouseHoverComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
Component for telling the PlantInfoDisplayComponent when the player has their mouse cursor hovering
over a plant.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Called when the entity is created and registered.booleanChecks whether the plant information should no longer be used.booleanChecks if the plant is dead.booleanChecks whether plant information is currently being shown.voidsetNoMoreUse(boolean noMoreUse) Sets whether the plant information should no longer be used.voidsetPlantDied(boolean plantDied) Used to signal when the plant has died.voidsetShowInfo(boolean showInfo) Sets whether plant information is currently being shown.voidupdate()Called once per frame of the game, and should be used for most component logic.voidUsed to update the information being shown in the Plant information widget.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write
-
Constructor Details
-
PlantMouseHoverComponent
public PlantMouseHoverComponent()
-
-
Method Details
-
setPlantDied
public void setPlantDied(boolean plantDied) Used to signal when the plant has died. -
isPlantDead
public boolean isPlantDead()Checks if the plant is dead.- Returns:
- true if the plant is dead, false otherwise.
-
isShowInfo
public boolean isShowInfo()Checks whether plant information is currently being shown.- Returns:
trueif plant information is being shown,falseotherwise.
-
setShowInfo
public void setShowInfo(boolean showInfo) Sets whether plant information is currently being shown.- Parameters:
showInfo-trueto indicate that plant information is being shown,falseotherwise.
-
isNoMoreUse
public boolean isNoMoreUse()Checks whether the plant information should no longer be used.- Returns:
trueif the plant information should no longer be used,falseotherwise.
-
setNoMoreUse
public void setNoMoreUse(boolean noMoreUse) Sets whether the plant information should no longer be used.- Parameters:
noMoreUse-trueto indicate that the plant information should no longer be used,falseotherwise.
-
create
public void create()Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
update
public void update()Called once per frame of the game, and should be used for most component logic. Not called if component is disabled. -
updateInfo
public void updateInfo()Used to update the information being shown in the Plant information widget.
-