Class PlantInfoDisplayComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.ui.UIComponent
com.csse3200.game.components.plants.PlantInfoDisplayComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,com.badlogic.gdx.utils.Json.Serializable
,Renderable
,Comparable<Renderable>
A UI component for displaying information about a plant.
-
Field Summary
Fields inherited from class com.csse3200.game.ui.UIComponent
skin, stage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the window of any plant information.void
create()
Called when the entity is created and registered.protected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Has no use in this component but is required by the UIComponent class.boolean
Whether first contact has been made or notvoid
Marks that the first contact has been made with the plant.void
Create and display the window for first contact with the plant.void
showPlantInfo
(String plantName, String plantInfo) Display the string of plant information in the window.void
update()
Called once per frame of the game, and should be used for most component logic.Methods inherited from class com.csse3200.game.ui.UIComponent
getLayer, getZIndex
Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, dispose, render
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.csse3200.game.rendering.Renderable
render
-
Constructor Details
-
PlantInfoDisplayComponent
public PlantInfoDisplayComponent()
-
-
Method Details
-
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.- Overrides:
create
in classUIComponent
-
madeFirstContact
public void madeFirstContact()Marks that the first contact has been made with the plant. -
getMadeFirstContact
public boolean getMadeFirstContact()Whether first contact has been made or not- Returns:
- True if first contact has been made, false otherwise
-
showPlantInfo
Display the string of plant information in the window. This information is provided by the plant component and is already formatted. This occurs when the player hovers their mouse cursor over a plant.- Parameters:
plantName
- The name of the plant.plantInfo
- - Information about the current state of the plant.
-
clearInfo
public void clearInfo()Clears the window of any plant information. -
makeFirstContactWindow
public void makeFirstContactWindow()Create and display the window for first contact with the plant. -
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Has no use in this component but is required by the UIComponent class.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-
update
public void update()Description copied from class:Component
Called once per frame of the game, and should be used for most component logic. Not called if component is disabled.
-