Class CurrentWaveDisplay

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

public class CurrentWaveDisplay extends UIComponent
A UI component for displaying the current wave number. Shows the current wave and can be updated when waves change. Now integrated with the WaveManager system.
  • Constructor Details

    • CurrentWaveDisplay

      public CurrentWaveDisplay()
      Creates a new current wave display component.
    • CurrentWaveDisplay

      public CurrentWaveDisplay(WaveManager waveManager)
      Creates a new current wave display component.
      Parameters:
      waveManager - the WaveManager to listen to for wave events
  • Method Details

    • create

      public void create()
      Description copied from class: Component
      Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.
      Overrides:
      create in class UIComponent
    • draw

      public 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.
    • updateWaveDisplay

      public void updateWaveDisplay(int waveNumber)
      Updates the wave display on the UI. This method is called by the event system when "waveChanged" or "newWaveStarted" events are triggered.
      Parameters:
      waveNumber - the new wave number to display
    • getCurrentWaveNumber

      public int getCurrentWaveNumber()
      Gets the current wave number being displayed.
      Returns:
      current wave number
    • getCurrentWaveString

      public String getCurrentWaveString()
      Gets the current wave being displayed as a formatted string. Returns "Wave X" for active waves or "No Wave Active" for wave 0.
      Returns:
      formatted wave string for display
    • setWave

      public void setWave(int waveNumber)
      Manually trigger a wave change for testing purposes.
      Parameters:
      waveNumber - the new wave number
    • 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 interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class RenderComponent