Class PlayerStatsDisplay
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.ui.UIComponent
com.deco2800.game.components.player.PlayerStatsDisplay
- All Implemented Interfaces:
Disposable,Renderable,java.lang.Comparable<Renderable>
public class PlayerStatsDisplay extends UIComponent
A ui component for displaying player stats, e.g. health.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description PlayerStatsDisplay() -
Method Summary
Modifier and Type Method Description voidaddAddMaxHealthImage()voidaddDecreaseHealthImage()voidaddDecreaseSpeedImage()voidaddIncreaseHealthImage()voidaddPoisoningImage()voidcreate()Creates reusable ui styles and adds actors to the stage.voiddispose()Called when the component is disposed.voiddraw(SpriteBatch batch)Draw the renderable.voidremoveAddMaxHealthImage()voidremoveAllBuff()voidremoveDecreaseHealthImage()voidremoveDecreaseSpeedImage()voidremoveIncreaseHealthImage()voidremovePoisoningImage()voidupdatePlayerGold(int gold)voidupdatePlayerHealthUI(int health)Updates the player's health on the ui.Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
PlayerStatsDisplay
public PlayerStatsDisplay()
-
-
Method Details
-
create
public void create()Creates reusable ui styles and adds actors to the stage. And starts the timer.- 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.
-
updatePlayerHealthUI
public void updatePlayerHealthUI(int health)Updates the player's health on the ui. And check if the player is dead. If dead, then timer stops.- Parameters:
health- player health
-
addPoisoningImage
public void addPoisoningImage() -
removePoisoningImage
public void removePoisoningImage() -
addDecreaseSpeedImage
public void addDecreaseSpeedImage() -
removeDecreaseSpeedImage
public void removeDecreaseSpeedImage() -
addDecreaseHealthImage
public void addDecreaseHealthImage() -
removeDecreaseHealthImage
public void removeDecreaseHealthImage() -
addIncreaseHealthImage
public void addIncreaseHealthImage() -
addAddMaxHealthImage
public void addAddMaxHealthImage() -
removeAddMaxHealthImage
public void removeAddMaxHealthImage() -
removeIncreaseHealthImage
public void removeIncreaseHealthImage() -
removeAllBuff
public void removeAllBuff() -
updatePlayerGold
public void updatePlayerGold(int gold) -
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here.- Specified by:
disposein interfaceDisposable- Overrides:
disposein classRenderComponent
-