Class FoodDisplay
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
com.deco2800.game.ui.UIComponent
com.deco2800.game.components.foodAndwater.FoodDisplay
- All Implemented Interfaces:
 Disposable,Renderable,java.lang.Comparable<Renderable>
public class FoodDisplay extends UIComponent
A ui component for displaying food system. Player lose a chicken for 3 sec
- 
Field Summary
 - 
Constructor Summary
Constructors Constructor Description FoodDisplay() - 
Method Summary
Modifier and Type Method Description static voidaddOrRemoveImage(int value)Add/remove a imagevoidcreate()Creates reusable food ui styles and adds actors to the stage.voiddispose()remove foodImage by useing a for loopvoiddraw(SpriteBatch batch)Draw the renderable.java.util.ArrayList<Image>getHunger()return the foodImagestatic booleanisHunger()when player have no food, this function will return truevoidupdate()Reduce food when time increasevoidupdatePlayerHealth(int dis)voidupdatePlayerTimerUI(int dis)Updates the Chicken 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
- 
FoodDisplay
public FoodDisplay() 
 - 
 - 
Method Details
- 
create
public void create()Creates reusable food 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 food when time increase - 
updatePlayerHealth
public void updatePlayerHealth(int dis) - 
updatePlayerTimerUI
public void updatePlayerTimerUI(int dis)Updates the Chicken ui time by time increase. - 
dispose
public void dispose()remove foodImage by useing a for loop- Specified by:
 disposein interfaceDisposable- Overrides:
 disposein classRenderComponent
 - 
getHunger
return the foodImage - 
addOrRemoveImage
public static void addOrRemoveImage(int value)Add/remove a image- Parameters:
 value- = 1, add a image;value- = -1, remove a image
 - 
isHunger
public static boolean isHunger()when player have no food, this function will return true 
 -