Class WaterDisplay
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.ui.UIComponent
com.deco2800.game.components.foodAndwater.WaterDisplay
- All Implemented Interfaces:
 Disposable,Renderable,java.lang.Comparable<Renderable>
public class WaterDisplay extends UIComponent
A ui component for displaying water system. Player lose a chicken for 2 sec
- 
Field Summary
Fields Modifier and Type Field Description static java.util.ArrayList<Image>waterImage - 
Constructor Summary
Constructors Constructor Description WaterDisplay() - 
Method Summary
Modifier and Type Method Description static voidaddOrRemoveImage(int value)Add/remove a imagevoidcreate()Creates reusable water ui styles and adds actors to the stage.voiddispose()remove waterImage by using a for loopvoiddraw(SpriteBatch batch)Draw the renderable.java.util.ArrayList<Image>getThirst()return the waterImagestatic booleanisThirst()when player have no water, this function will return truevoidupdate()Reduce water when time increasevoidupdatePlayerHealth(int dis)voidupdatePlayerTimerUI(int dis)Updates the water ui time by time increase.Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate 
- 
Field Details
 - 
Constructor Details
- 
WaterDisplay
public WaterDisplay() 
 - 
 - 
Method Details
- 
create
public void create()Creates reusable water ui styles and adds actors to the stage. And starts the counting the time.- Overrides:
 createin classUIComponent
 - 
draw
Description copied from class:RenderComponentDraw the renderable. Should be called only by the renderer, not manually.- Specified by:
 drawin classRenderComponent- Parameters:
 batch- Batch to render to.
 - 
update
public void update()Reduce water when time increase - 
updatePlayerHealth
public void updatePlayerHealth(int dis) - 
updatePlayerTimerUI
public void updatePlayerTimerUI(int dis)Updates the water ui time by time increase. - 
dispose
public void dispose()remove waterImage by using a for loop- Specified by:
 disposein interfaceDisposable- Overrides:
 disposein classRenderComponent
 - 
getThirst
return the waterImage - 
addOrRemoveImage
public static void addOrRemoveImage(int value)Add/remove a image- Parameters:
 value- = 1, add a image;value- = -1, remove a image
 - 
isThirst
public static boolean isThirst()when player have no water, this function will return true 
 -