Class WeatherEvent

java.lang.Object
com.csse3200.game.areas.weather.WeatherEvent
Direct Known Subclasses:
AcidShowerEvent, BlizzardEvent, RainStormEvent, SolarSurgeEvent

public abstract class WeatherEvent extends Object
Represents a Weather Event like Acid Shower or Solar Surge. These are updated based on in-game hours.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final EventHandler
     
    protected int
    Number of in-game hours that the WeatherEvent can be active for
    protected int
    Number of in-game hours until the WeatherEvent is able to be triggered and affects the in-game climate
    protected final int
    The priority of the WeatherEvent so that some weather can override others if they are important
    protected final float
    The severity of the WeatherEvent which can affect the climate modifiers depending on the implementation of the WeatherEvent.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    WeatherEvent(int numHoursUntil, int duration, int priority, float severity)
    Constructs an WeatherEvent with a given duration, priority and countdown
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Gets the duration of the weather event
    int
     
    int
    Returns the priority of the weather event
    float
    Gets the severity of this weather event
    boolean
    Determines whether the weather event is active based on the countdown timer and the duration
    boolean
    Determines whether the weather event has finished
    abstract void
    Starts the visual effect for the weather event
    abstract void
    Stops the visual effect for the weather event
    void
    Updates the duration or countdown timer for the weather event.
    void
    write(com.badlogic.gdx.utils.Json json)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • priority

      protected final int priority
      The priority of the WeatherEvent so that some weather can override others if they are important
    • severity

      protected final float severity
      The severity of the WeatherEvent which can affect the climate modifiers depending on the implementation of the WeatherEvent. This ranges from 1.0 to 1.5
    • climateControllerEvents

      protected final EventHandler climateControllerEvents
    • numHoursUntil

      protected int numHoursUntil
      Number of in-game hours until the WeatherEvent is able to be triggered and affects the in-game climate
    • duration

      protected int duration
      Number of in-game hours that the WeatherEvent can be active for
  • Constructor Details

    • WeatherEvent

      protected WeatherEvent(int numHoursUntil, int duration, int priority, float severity) throws IllegalArgumentException
      Constructs an WeatherEvent with a given duration, priority and countdown
      Parameters:
      numHoursUntil - number of in-game hours until the weather event can occur
      duration - number of in-game hours that the event can occur for
      priority - priority of the weather event
      Throws:
      IllegalArgumentException
  • Method Details

    • updateTime

      public void updateTime()
      Updates the duration or countdown timer for the weather event. This is called by the ClimateController every in-game hour
    • getDuration

      public int getDuration()
      Gets the duration of the weather event
      Returns:
      the amount of time the weather event has left
    • getNumHoursUntil

      public int getNumHoursUntil()
    • getPriority

      public int getPriority()
      Returns the priority of the weather event
      Returns:
      weather event priority
    • isActive

      public boolean isActive()
      Determines whether the weather event is active based on the countdown timer and the duration
      Returns:
      boolean value representing
    • isExpired

      public boolean isExpired()
      Determines whether the weather event has finished
      Returns:
      boolean value representing whether the weather event is finished or not
    • getSeverity

      public float getSeverity()
      Gets the severity of this weather event
      Returns:
      weather event severity
    • startEffect

      public abstract void startEffect()
      Starts the visual effect for the weather event
    • stopEffect

      public abstract void stopEffect()
      Stops the visual effect for the weather event
    • write

      public void write(com.badlogic.gdx.utils.Json json)