public static void AddCTSRuntimeWeatherToScene(MenuCommand menuCommand) { //Add a weather manager GameObject ctsWeatherManager = GameObject.Find("CTS Weather Manager"); if (ctsWeatherManager == null) { ctsWeatherManager = new GameObject(); ctsWeatherManager.name = "CTS Weather Manager"; ctsWeatherManager.AddComponent <CTSWeatherManager>(); CompleteTerrainShader.SetDirty(ctsWeatherManager, false, false); } EditorGUIUtility.PingObject(ctsWeatherManager); //And now add weather controllers foreach (var terrain in Terrain.activeTerrains) { CompleteTerrainShader shader = terrain.gameObject.GetComponent <CompleteTerrainShader>(); if (shader != null) { CTSWeatherController controller = terrain.gameObject.GetComponent <CTSWeatherController>(); if (controller == null) { controller = terrain.gameObject.AddComponent <CTSWeatherController>(); CompleteTerrainShader.SetDirty(terrain, false, false); CompleteTerrainShader.SetDirty(controller, false, false); } } } }
public static void AddWorldAPIToScene(MenuCommand menuCommand) { //First - are we even here present Type worldAPIType = CompleteTerrainShader.GetType("WAPI.WorldManager"); if (worldAPIType == null) { EditorUtility.DisplayDialog("World Manager API", "World Manager is not present in your project. Please go to http://www.procedural-worlds.com/blog/wapi/ to learn about it.", "OK"); Application.OpenURL("http://www.procedural-worlds.com/blog/wapi/"); Application.OpenURL("https://github.com/adamgoodrich/WorldManager"); return; } //First add a weather manager GameObject ctsWeatherManager = GameObject.Find("CTS Weather Manager"); if (ctsWeatherManager == null) { ctsWeatherManager = new GameObject(); ctsWeatherManager.name = "CTS Weather Manager"; ctsWeatherManager.AddComponent <CTSWeatherManager>(); CompleteTerrainShader.SetDirty(ctsWeatherManager, false, false); } EditorGUIUtility.PingObject(ctsWeatherManager); //And now add weather controllers foreach (var terrain in Terrain.activeTerrains) { CompleteTerrainShader shader = terrain.gameObject.GetComponent <CompleteTerrainShader>(); if (shader != null) { CTSWeatherController controller = terrain.gameObject.GetComponent <CTSWeatherController>(); if (controller == null) { controller = terrain.gameObject.AddComponent <CTSWeatherController>(); CompleteTerrainShader.SetDirty(terrain, false, false); CompleteTerrainShader.SetDirty(controller, false, false); } } } //And now add world API integration component to weather manager #if WORLDAPI_PRESENT var worldAPIIntegration = ctsWeatherManager.GetComponent <CTSWorldAPIIntegration>(); if (worldAPIIntegration == null) { worldAPIIntegration = ctsWeatherManager.AddComponent <CTSWorldAPIIntegration>(); } #endif }
public void UnregisterWeatherController(CTSWeatherController weatherController) { this.m_controllerSet.Remove(weatherController); }
public void RegisterWeatherController(CTSWeatherController weatherController) { this.m_controllerSet.Add(weatherController); }