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 TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.boolean
Checks whether the plant information should no longer be used.boolean
Checks if the plant is dead.boolean
Checks whether plant information is currently being shown.void
setNoMoreUse
(boolean noMoreUse) Sets whether the plant information should no longer be used.void
setPlantDied
(boolean plantDied) Used to signal when the plant has died.void
setShowInfo
(boolean showInfo) Sets whether plant information is currently being shown.void
update()
Called once per frame of the game, and should be used for most component logic.void
Used 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:
true
if plant information is being shown,false
otherwise.
-
setShowInfo
public void setShowInfo(boolean showInfo) Sets whether plant information is currently being shown.- Parameters:
showInfo
-true
to indicate that plant information is being shown,false
otherwise.
-
isNoMoreUse
public boolean isNoMoreUse()Checks whether the plant information should no longer be used.- Returns:
true
if the plant information should no longer be used,false
otherwise.
-
setNoMoreUse
public void setNoMoreUse(boolean noMoreUse) Sets whether the plant information should no longer be used.- Parameters:
noMoreUse
-true
to indicate that the plant information should no longer be used,false
otherwise.
-
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.
-