Created
November 10, 2019 06:00
-
-
Save nickiaconis/70f0ac5110e61d7215342145ce62c3c0 to your computer and use it in GitHub Desktop.
idea for mod to change seasons in Cities: Skylines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pseudo code for idea to change seasons in Cities: Skylines | |
onInterval() { | |
string loadedEnvironment = Singleton<LoadingManager>.instance.m_loadedEnvironment; | |
string simulationEnvironment = Singleton<SimulationManager>.instance.m_metaData.m_environment; | |
if (winterDateRange.contains(currentDate) && loadedEnvironment != WINTER) { | |
// Properties scene loading/unloading based on propertiesScene loading in LoadingManager#LoadLevelCoroutine | |
// not sure if unloading will break things | |
// also not sure if loading second properties scene will break things | |
// order may matter | |
// may also simply not be possible | |
AsyncOperation opLoad = SceneManager.LoadSceneAsync(WINTER + "Properties", LoadSceneMode.Additive); | |
AsyncOperation opUnload = SceneManager.UnloadSceneAsync(loadedEnvironment + "Properties"); | |
while(!opLoad.isDone && !opUnload.isDone) { | |
yield return 0; | |
} | |
Singleton<LoadingManager>.instance.m_loadedEnvironment = WINTER; | |
// this may break things, but it'd be ideal to do for optimization | |
Resources.UnloadUnusedAssets(); | |
} else if (!winterDateRange.contains(currentDate) && loadedEnvironment == WINTER && /* to prevent reloading winter forever */ simulationEnvironment != WINTER) { | |
// Properties scene loading/unloading based on propertiesScene loading in LoadingManager#LoadLevelCoroutine | |
// not sure if unloading will break things | |
// also not sure if loading second properties scene will break things | |
// order may matter | |
// may also simply not be possible | |
AsyncOperation opLoad = SceneManager.LoadSceneAsync(simulationEnvironment + "Properties", LoadSceneMode.Additive); | |
AsyncOperation opUnload = SceneManager.UnloadSceneAsync(loadedEnvironment + "Properties"); | |
while(!opLoad.isDone && !opUnload.isDone) { | |
yield return 0; | |
} | |
Singleton<LoadingManager>.instance.m_loadedEnvironment = simulationEnvironment; | |
// this may break things, but it'd be ideal to do for optimization | |
Resources.UnloadUnusedAssets(); | |
} | |
} | |
// or something like that anyway :P |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment