Class 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 Details

  • Constructor Details

  • Method Details

    • create

      public void create()
      Creates reusable water ui styles and adds actors to the stage. And starts the counting the time.
      Overrides:
      create in class UIComponent
    • draw

      public void draw​(SpriteBatch batch)
      Description copied from class: RenderComponent
      Draw the renderable. Should be called only by the renderer, not manually.
      Specified by:
      draw in class RenderComponent
      Parameters:
      batch - Batch to render to.
    • update

      public void update()
      Reduce water when time increase
      Overrides:
      update in class Component
    • 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:
      dispose in interface Disposable
      Overrides:
      dispose in class RenderComponent
    • getThirst

      public java.util.ArrayList<Image> 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