# 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:

<figure><img src="https://1131436974-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rEHd0nHFvWCSkMEfAjl%2Fuploads%2FXtzdPwIb8bqpl2upNeXi%2Fimage.png?alt=media&#x26;token=bf3193f8-b403-40ea-b372-e6dd291217bd" alt=""><figcaption><p>WeatherController prefab</p></figcaption></figure>

### Parameters in inspector

<figure><img src="https://1131436974-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9rEHd0nHFvWCSkMEfAjl%2Fuploads%2Fy3r8xO91mUddPi7qzsph%2Fimage.png?alt=media&#x26;token=1bda9ac4-98b6-4162-b6c0-15d840e0ce8f" alt=""><figcaption><p>Parameters in inspector</p></figcaption></figure>

**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

```csharp
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:*

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

***

```csharp
void SetWindState(WindState windState)
```

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

*Example:*

```csharp
weatherController.SetWindState(WindState.Medium);
```

***

{% hint style="info" %}
You can see how it works on the `WeatherTestScene`, which is situated in `Assets/Heroic Engine/Example/Scenes` directory.
{% endhint %}
