Class WeatherIcon

java.lang.Object
com.badlogic.gdx.scenes.scene2d.Actor
com.deco2800.game.components.weather.WeatherIcon

public class WeatherIcon extends com.badlogic.gdx.scenes.scene2d.Actor
  • Constructor Summary

    Constructors
    Constructor
    Description
    WeatherIcon(com.badlogic.gdx.scenes.scene2d.ui.Label countdownTimer)
    Instantiates WeatherIcon class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    This method is called when the timer for the weather expires.
    void
    draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
    Draws the weather layout to the game screen.
    int
    Getter method to access the current index of the Weather Icon.
    float
    Getter method to obtain the movement speed factor.
    com.badlogic.gdx.scenes.scene2d.ui.Label
    Getter method to obtain the timer label.
    Getter method to obtain WeatherIconProperties.
    void
    Sets the layout of the weather, displaying the weather icon and the filter for a given index.
    void
    setTimerLabel(com.badlogic.gdx.scenes.scene2d.ui.Label countdownTimer)
    Setter method to set the timer label.

    Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor

    act, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, sizeChanged, stageToLocalCoordinates, toBack, toFront, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WeatherIcon

      public WeatherIcon(com.badlogic.gdx.scenes.scene2d.ui.Label countdownTimer)
      Instantiates WeatherIcon class. Upon creation, a random index is selected to pick the initial weather and corresponding effects in the game.
      Parameters:
      countdownTimer - A Label representing a countdown timer to be displayed in the game.
  • Method Details

    • getCurrentIndex

      public int getCurrentIndex()
      Getter method to access the current index of the Weather Icon.
      Returns:
      Int representing index of the weather icon.
    • changeWeatherImage

      public void changeWeatherImage()
      This method is called when the timer for the weather expires. It pseudo-randomly seeds a new index that is not the same as the previous index, and changes the relevant properties based on the new selected index.
    • getMovementSpeed

      public float getMovementSpeed()
      Getter method to obtain the movement speed factor.
      Returns:
      Float value representing movement speed.
    • layout

      public void layout()
      Sets the layout of the weather, displaying the weather icon and the filter for a given index.
    • draw

      public void draw(com.badlogic.gdx.graphics.g2d.Batch batch, float parentAlpha)
      Draws the weather layout to the game screen.
      Overrides:
      draw in class com.badlogic.gdx.scenes.scene2d.Actor
      Parameters:
      batch -
      parentAlpha -
    • getTimerLabel

      public com.badlogic.gdx.scenes.scene2d.ui.Label getTimerLabel()
      Getter method to obtain the timer label.
      Returns:
      A timer label representing the timer label of the object.
    • getWeatherIconProperties

      public WeatherIconProperties getWeatherIconProperties()
      Getter method to obtain WeatherIconProperties.
      Returns:
      WeatherIconProperties
    • setTimerLabel

      public void setTimerLabel(com.badlogic.gdx.scenes.scene2d.ui.Label countdownTimer)
      Setter method to set the timer label.
      Parameters:
      countdownTimer - A new Label to set the timer label to.