public static void initMod() { Debug.Log("init of EnhancedSky standalone"); gameobjectEnhancedSky = new GameObject("EnhancedSkyController"); componentPresetContainer = gameobjectEnhancedSky.AddComponent <PresetContainer>() as PresetContainer; SetPresetContainerValues(componentPresetContainer); PresetContainer.Instance = componentPresetContainer; componentSkyManager = gameobjectEnhancedSky.AddComponent <SkyManager>() as SkyManager; SkyManager.instance = componentSkyManager; componentCloudGenerator = gameobjectEnhancedSky.AddComponent <CloudGenerator>() as CloudGenerator; componentSkyManager.ModSelf = mod; starMaskMat = new Material(shaderDepthMask); skyObjMat = new Material(shaderUnlitAlphaWithFade); componentSkyManager.StarMaskMat = starMaskMat; componentSkyManager.SkyObjMat = skyObjMat; componentSkyManager.StarsMat = starsMat; componentSkyManager.SkyMat = skyMat; if (containerPrefab) { GameObject container = Instantiate(containerPrefab) as GameObject; container.transform.SetParent(GameManager.Instance.ExteriorParent.transform, true); componentSkyManager.Container = container; //container.AddComponent<MoonController>(); //container.AddComponent<AmbientFogLightController>(); //container.transform.Find("SkyCam").gameObject.AddComponent<SkyCam>(); //container.transform.Find("Stars").Find("StarParticles").gameObject.AddComponent<StarController>(); //container.transform.Find("Rotator").gameObject.AddComponent<RotationScript>(); //container.transform.Find("cloudPrefab").gameObject.AddComponent<Cloud>(); GameObject goParticles = container.transform.Find("Stars").Find("StarParticles").gameObject; goParticles.GetComponent <ParticleSystemRenderer>().sharedMaterial = new Material(shaderUnlitAlphaWithFade); GameObject goSun = container.transform.Find("Rotator").Find("Sun").gameObject; goSun.GetComponent <LensFlare>().flare = sunFlare; goSun.GetComponent <Light>().intensity = sunSize; } else { throw new System.NullReferenceException(); } componentSkyManager.ToggleEnhancedSky(true); componentSkyManager.UseSunFlare = enableSunFlare; componentSkyManager.cloudQuality = cloudQuality; componentSkyManager.SkyObjectSizeChange(0); // set normal size }
private bool GetRefrences() { try { if (!_cloudGen) { _cloudGen = this.GetComponent <CloudGenerator>(); } if (!_cloudGen) { _cloudGen = this.gameObject.AddComponent <CloudGenerator>(); } if (!dfallSky) { dfallSky = GameManager.Instance.SkyRig.gameObject; } if (!playerEE) { playerEE = GameManager.Instance.PlayerEnterExit; } if (!exteriorParent) { exteriorParent = GameManager.Instance.ExteriorParent; } if (!weatherMan) { weatherMan = GameManager.Instance.WeatherManager; } if (!postProcessingBehaviour) { postProcessingBehaviour = Camera.main.GetComponent <PostProcessingBehaviour>(); } } catch { DaggerfallUnity.LogMessage("Error in SkyManager.GetRefrences()", true); return(false); } if (dfallSky && playerEE && exteriorParent && weatherMan && _cloudGen && StarMaskMat && _skyObjMat && StarsMat && SkyMat) { return(true); } else { return(false); } }
private bool GetRefrences() { try { if (!_depthMaskShader) { _depthMaskShader = Resources.Load("DepthMask") as Shader; } if (!_UnlitAlphaFadeShader) { _UnlitAlphaFadeShader = Resources.Load("UnlitAlphaWithFade") as Shader; } if (!StarMaskMat) { StarMaskMat = new Material(_depthMaskShader); } if (!_skyObjMat) { _skyObjMat = new Material(_UnlitAlphaFadeShader); } if (!StarsMat) { StarsMat = Instantiate(Resources.Load("Stars")) as Material; } if (!SkyMat) { SkyMat = Instantiate(Resources.Load("Sky")) as Material; } if (!_cloudGen) { _cloudGen = this.GetComponent <CloudGenerator>(); } if (!_cloudGen) { _cloudGen = gameObject.AddComponent <CloudGenerator>(); } if (!_containerPrefab) { _containerPrefab = Resources.Load("EnhancedSkyContainer", typeof(GameObject)) as GameObject; } if (!dfallSky) { dfallSky = GameManager.Instance.SkyRig.gameObject; } if (!playerEE) { playerEE = GameManager.Instance.PlayerEnterExit; } if (!exteriorParent) { exteriorParent = GameManager.Instance.ExteriorParent; } if (!weatherMan) { weatherMan = GameManager.Instance.WeatherManager; } } catch { DaggerfallUnity.LogMessage("Error in SkyManager.GetRefrences()", true); return(false); } if (dfallSky && playerEE && exteriorParent && weatherMan && _cloudGen && _containerPrefab && _depthMaskShader && _UnlitAlphaFadeShader && StarMaskMat && _skyObjMat && StarsMat && SkyMat) { return(true); } else { return(false); } }
private bool GetRefrences() { try { if (!_depthMaskShader) _depthMaskShader = Resources.Load("DepthMask") as Shader; if (!_UnlitAlphaFadeShader) _UnlitAlphaFadeShader = Resources.Load("UnlitAlphaWithFade") as Shader; if (!StarMaskMat) StarMaskMat = new Material(_depthMaskShader); if (!_skyObjMat) _skyObjMat = new Material(_UnlitAlphaFadeShader); if (!StarsMat) StarsMat = Instantiate(Resources.Load("Stars")) as Material; if (!SkyMat) SkyMat = Instantiate(Resources.Load("Sky")) as Material; if (!_cloudGen) _cloudGen = this.GetComponent<CloudGenerator>(); if(!_cloudGen) _cloudGen = gameObject.AddComponent<CloudGenerator>(); if (!_containerPrefab) _containerPrefab = Resources.Load("EnhancedSkyContainer", typeof(GameObject)) as GameObject; if (!dfallSky) dfallSky = GameManager.Instance.SkyRig.gameObject; if (!playerEE) playerEE = GameManager.Instance.PlayerEnterExit; if (!exteriorParent) exteriorParent = GameManager.Instance.ExteriorParent; if (!weatherMan) weatherMan = GameManager.Instance.WeatherManager; } catch { DaggerfallUnity.LogMessage("Error in SkyManager.GetRefrences()", true); return false; } if (dfallSky && playerEE && exteriorParent && weatherMan && _cloudGen && _containerPrefab && _depthMaskShader && _UnlitAlphaFadeShader && StarMaskMat && _skyObjMat && StarsMat && SkyMat) return true; else return false; }