Package com.csse3200.game.areas.weather
Class ClimateController
java.lang.Object
com.csse3200.game.areas.weather.ClimateController
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new climate controller that listens to time events and maintains the in-game climate -
Method Summary
Modifier and TypeMethodDescriptionvoid
addWeatherEvent
(WeatherEvent event) Adds a weather event to the list of weather events stored in the climate controller classGets the current weather event that is occurringReturns the event handler for the Climate controller classvoid
Initialises the events and listeners for thisClimateController
.void
read
(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData) void
Gets the current weather event that is occurringvoid
setValues
(com.badlogic.gdx.utils.JsonValue jsonData) void
Updates the values of the game's climate based on current weather events.void
write
(com.badlogic.gdx.utils.Json json)
-
Constructor Details
-
ClimateController
public ClimateController()Creates a new climate controller that listens to time events and maintains the in-game climate
-
-
Method Details
-
initialiseEvents
public void initialiseEvents()Initialises the events and listeners for thisClimateController
. -
getEvents
Returns the event handler for the Climate controller class- Returns:
- Event handler
-
addWeatherEvent
Adds a weather event to the list of weather events stored in the climate controller class- Parameters:
event
- Weather event- Throws:
IllegalArgumentException
-
getCurrentWeatherEvent
Gets the current weather event that is occurring- Returns:
- current weather event, null if not event is occurring
-
setCurrentWeatherEvent
Gets the current weather event that is occurring -
updateClimate
public void updateClimate()Updates the values of the game's climate based on current weather events. Factoring in the in-game time and the weather event modifiers. -
write
public void write(com.badlogic.gdx.utils.Json json) - Specified by:
write
in interfacecom.badlogic.gdx.utils.Json.Serializable
-
read
public void read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData) - Specified by:
read
in interfacecom.badlogic.gdx.utils.Json.Serializable
-
setValues
public void setValues(com.badlogic.gdx.utils.JsonValue jsonData)
-