I am writing code for my weather that will enable and disable various particle effects according to the weather that is currently active and according to the time of day, my problem at the moment is in the pauseAll function, after it pauses everything how do I get it to return to the place where it was called? say after the “if (weatherChance <= 10) {” it calls that function how would I get it to return to that exact line where it was called after it is done pausing everything?
void springWeatherChances() {
//chance to Change the weather at morning.
if (currentTimeOfDay == .25) {
weatherChance = Random.Range(0, 100);
//40% chance that the weather will change.
if (weatherChance >= 60) {
weatherChance = Random.Range(0, 100);
// 10% chance of default weather.
if (weatherChance <= 10) {
pauseAll();
defaultCloudsDay.Play();
defaultWeatherActive = true;
}
// 10% chance of foggy weather.
if (weatherChance < 10 || weatherChance >= 20) {
pauseAll();
defaultCloudsDay.Play();
foggyWeatherActive = true;
}
}
}
}
void pauseAll() {
defaultCloudsDay.Pause();
defaultCloudsNight.Pause();
foggyClouds.Pause();
overcastClouds.Pause();
darkClouds.Pause();
clearClouds.Pause();
ligthRainClouds.Pause();
rainClouds.Pause();
heavyRainClouds.Pause();
ligthSnowClouds.Pause();
snowClouds.Pause();
heavySnowClouds.Pause();
fog.Pause();
ligthRain.Pause();
rain.Pause();
heavyRain.Pause();
ligthSnow.Pause();
snow.Pause();
heavySnow.Pause();
defaultWeatherActive = false;
foggyWeatherActive = false;
overcastWeatherActive = false;
darkCloudyWeatherActive = false;
clearWeatherActive = false;
lightRainWeatherActive = false;
rainWeatherActive = false;
heavyRainWeatherActive = false;
lightSnowWeatherActive = false;
snowWeatherActive = false;
heavySnowWeatherActive = false;
}