Weather Controller

Presented by IWeatherController interface, this system allows to start or stop raining, start or stop wind and change their intensity.

To use this system, just drag WeatherController prefab onto your game scene and set it up as you wish:

WeatherController prefab

Parameters in inspector

Parameters in inspector

Rain Particles – reference to rain object. Plese, don't change it.

Initial Weather – initial rain state. It can be None, RainingLight, RainingMedium or RainingHeavy.

Initial Wind State – initial wind power. It can be None, Light, Medium or Heavy.


You can also use this system via code. For this, inject IWeatherController interface into your class and call needed methods.

Available methods

void SetWeatherState(WeatherState weatherState, float fadeDuration = 3f)

This method allows to set current weather state. It can be None, RainingLight, RainingMedium or RainingHeavy. You can also set certain weather change time by fadeDuration parameter.

Example:

weatherController.SetWeatherState(WeatherState.RainingHeavy, 5f);

void SetWindState(WindState windState)

This method allows to set current wind power. It can be None, Light, Medium or Heavy.

Example:

weatherController.SetWindState(WindState.Medium);

You can see how it works on the WeatherTestScene, which is situated in Assets/Heroic Engine/Example/Scenes directory.

Last updated