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 void
addAddMaxHealthImage()
void
addDecreaseHealthImage()
void
addDecreaseSpeedImage()
void
addIncreaseHealthImage()
void
addPoisoningImage()
void
create()
Creates reusable ui styles and adds actors to the stage.void
dispose()
Called when the component is disposed.void
draw(SpriteBatch batch)
Draw the renderable.void
removeAddMaxHealthImage()
void
removeAllBuff()
void
removeDecreaseHealthImage()
void
removeDecreaseSpeedImage()
void
removeIncreaseHealthImage()
void
removePoisoningImage()
void
updatePlayerGold(int gold)
void
updatePlayerHealthUI(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:
create
in classUIComponent
-
draw
Description copied from class:RenderComponent
Draw the renderable. Should be called only by the renderer, not manually.- Specified by:
draw
in 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:Component
Called when the component is disposed. Dispose of any internal resources here.- Specified by:
dispose
in interfaceDisposable
- Overrides:
dispose
in classRenderComponent
-