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 EventHandlerprotected intNumber of in-game hours that theWeatherEventcan be active forprotected intNumber of in-game hours until theWeatherEventis able to be triggered and affects the in-game climateprotected final intThe priority of theWeatherEventso that some weather can override others if they are importantprotected final floatThe severity of theWeatherEventwhich can affect the climate modifiers depending on the implementation of theWeatherEvent. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedWeatherEvent(int numHoursUntil, int duration, int priority, float severity) Constructs anWeatherEventwith a given duration, priority and countdown -
Method Summary
Modifier and TypeMethodDescriptionintGets the duration of the weather eventintintReturns the priority of the weather eventfloatGets the severity of this weather eventbooleanisActive()Determines whether the weather event is active based on the countdown timer and the durationbooleanDetermines whether the weather event has finishedabstract voidStarts the visual effect for the weather eventabstract voidStops the visual effect for the weather eventvoidUpdates the duration or countdown timer for the weather event.voidwrite(com.badlogic.gdx.utils.Json json)
-
Field Details
-
numHoursUntil
protected int numHoursUntilNumber of in-game hours until theWeatherEventis able to be triggered and affects the in-game climate -
duration
protected int durationNumber of in-game hours that theWeatherEventcan be active for -
priority
protected final int priorityThe priority of theWeatherEventso that some weather can override others if they are important -
severity
protected final float severityThe severity of theWeatherEventwhich can affect the climate modifiers depending on the implementation of theWeatherEvent. This ranges from 1.0 to 1.5 -
climateControllerEvents
-
-
Constructor Details
-
WeatherEvent
protected WeatherEvent(int numHoursUntil, int duration, int priority, float severity) throws IllegalArgumentException Constructs anWeatherEventwith 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 theClimateControllerevery 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)
-