Weather
Reminder - Keep Daily Backups
When working on a strategy game with a kit as big as the Complete Kit - always keep a working daily backup! Save yourself the trouble of rolling-back changes and losing work.
The City Building Complete Kit includes 3D weather effects to enhance the quality of your gameplay. Both clear weather, rain, and snow weather controls are included in the Scripts/SFX/RainSnow.cs script. These automatically cycle clear to rain 3 times, then clear to snow 3 times. Settings can be changed in the RainSnow.cs script.
(If you're interested in documentation about daytime and nighttime effects, click on the menu on the left to learn more)
Rain Effects
The City Building Complete Kit rotates between clear and rain weather effects. These are 3D effects overlayed on top of the 2D gameplay. Combined with ambient sound effects and the daytime / night time cycle makes for some amazing visuals.
Snowing Effects
Snowing effects are included for winter season gameplay. Snowstorms begin with falling snow and then later end with the entire map covered in snow through the Coroutine called FadeSnowOnSprites.
Snow cycle finished
When the snow cycle has finished, the coroutine FadeSnowOnSprites in RainSnow.cs changes the terrain landscape.
Snowy landscape - nighttime moonlight example
Script Reference
Inside RainSnow.cs you'll see the function SwitchClearRain(). This function initiates either rain or snow effects.
//you can just erase this so the winter doesn't cycle
winterSwitchCounter++;
if (winterSwitchCounter == 3) //rains 3 times, snows 3 times
{
terrainSnow.SetActive(true);
isWinter = !isWinter;
soundFX.isWinter = isWinter;
winterSwitchCounter = 0;
if(!isWinter)
StartCoroutine("FadeSnowOnSprites");//turn winter off
ToggleTerrainSnow();
}
Weather and day-night are connected, with 2 revolving ambient sound sources and fade in-out effects; the other 2 sound sources are music and menu "clicks"/in-game sounds. Snow and shadows are alpha - variable
Disable Rain and Snow Effects
Open the scenes/Game scene. In the Hierarchy you'll see AmbientController. Click this to open the Inspector.
From the AmbientController Inspector, locate the Transition On checkbox under the Rain Snow (Script). Uncheck to disable the RainSnow.cs transitions.
void Start ()
{
if(transitionOn)
{
color = rainVignete.color;
GetSnowTerrainMaterials();
SetSnowColor(new Color(1.0f, 1.0f, 1.0f, 0.0f));
InvokeRepeating("Transition",transitionInterval*60,transitionInterval*60);//convert seconds
terrainSnow.SetActive(false);
}
}
Change the Transition Times
Also on the Inspector menu you can change the transition interval (in minutes) to adjust how long the cycles last and how fast the transition speed (in minutes).
Disable Snow Cycles (But Keep Rain Cycles)
Disabling snow cycles but keeping the rain cycle is easy. Simply remove the following text from the SwitchClearRain() function in Scripts/SFX/RainSnow.cs
//you can just erase this so the winter doesn't cycle
winterSwitchCounter++;
Here's an excerpt from the function where you'll find that line:
public void SwitchClearRain()
{
clearWeather = ! clearWeather;
if (!clearWeather)
{
rainVignete.gameObject.SetActive (true);
//you can just erase this so the winter doesn't cycle
winterSwitchCounter++;
if (winterSwitchCounter == 3) //rains 3 times, snows 3 times
{
terrainSnow.SetActive(true);
isWinter = !isWinter;
soundFX.isWinter = isWinter;
winterSwitchCounter = 0;
if(!isWinter)
StartCoroutine("FadeSnowOnSprites");//turn winter off
ToggleTerrainSnow();
}
....
By removing winterSwitchCounter++; you prevent the count from incrementing and triggering snow cycles for 3 times, which reverses after 3 more times because of the line isWinter = !isWinter;
Daytime and Nighttime Effects
To learn more about daytime and nighttime cycles in the City Building Complete Kit, please click on the menu "Daytime Nighttime Cycles" on the left under Gameplay to learn more.
Updated less than a minute ago