Package com.csse3200.game.areas.weather
Class WeatherEvent
java.lang.Object
com.csse3200.game.areas.weather.WeatherEvent
- Direct Known Subclasses:
AcidShowerEvent
,BlizzardEvent
,RainStormEvent
,SolarSurgeEvent
Represents a Weather Event like Acid Shower or Solar Surge. These are updated based on in-game hours.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EventHandler
protected int
Number of in-game hours that theWeatherEvent
can be active forprotected int
Number of in-game hours until theWeatherEvent
is able to be triggered and affects the in-game climateprotected final int
The priority of theWeatherEvent
so that some weather can override others if they are importantprotected final float
The severity of theWeatherEvent
which can affect the climate modifiers depending on the implementation of theWeatherEvent
. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
WeatherEvent
(int numHoursUntil, int duration, int priority, float severity) Constructs anWeatherEvent
with a given duration, priority and countdown -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the duration of the weather eventint
int
Returns the priority of the weather eventfloat
Gets the severity of this weather eventboolean
isActive()
Determines whether the weather event is active based on the countdown timer and the durationboolean
Determines whether the weather event has finishedabstract void
Starts the visual effect for the weather eventabstract void
Stops the visual effect for the weather eventvoid
Updates the duration or countdown timer for the weather event.void
write
(com.badlogic.gdx.utils.Json json)
-
Field Details
-
priority
protected final int priorityThe priority of theWeatherEvent
so that some weather can override others if they are important -
severity
protected final float severityThe severity of theWeatherEvent
which can affect the climate modifiers depending on the implementation of theWeatherEvent
. This ranges from 1.0 to 1.5 -
climateControllerEvents
-
numHoursUntil
protected int numHoursUntilNumber of in-game hours until theWeatherEvent
is able to be triggered and affects the in-game climate -
duration
protected int durationNumber of in-game hours that theWeatherEvent
can be active for
-
-
Constructor Details
-
WeatherEvent
protected WeatherEvent(int numHoursUntil, int duration, int priority, float severity) throws IllegalArgumentException Constructs anWeatherEvent
with a given duration, priority and countdown- Parameters:
numHoursUntil
- number of in-game hours until the weather event can occurduration
- number of in-game hours that the event can occur forpriority
- 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 theClimateController
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)
-