Class DayNightClockComponent

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, Renderable, Comparable<Renderable>

public class DayNightClockComponent extends UIComponent
Defines a Clock UI element that displays the current phase of the day/night cycle
  • Constructor Details

    • DayNightClockComponent

      public DayNightClockComponent()
  • Method Details

    • create

      public void create()
      Creates the clock UI component and adds the event listener for EVENT_PART_OF_DAY_PASSED from DayNightCycleService
      Overrides:
      create in class UIComponent
    • dispose

      public void dispose()
      Clears the current clock face
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class RenderComponent
    • draw

      protected void draw(com.badlogic.gdx.graphics.g2d.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.
    • loadFromSave

      public void loadFromSave()
      Loads the clock when a save is loaded. Sets the current sprite equal to the current DayNightCycle day number and status
    • getCurrentSprite

      public int getCurrentSprite()
      for testing purposes
      Returns:
      index of the current sprite