void InitSkyAndOceanNodes() { m_skyNode = (SkyNode)Scatterer.Instance.scaledSpaceCamera.gameObject.AddComponent(typeof(SkyNode)); m_skyNode.setManager(this); m_skyNode.setCelestialBodyName(parentCelestialBody.name); m_skyNode.setParentScaledTransform(parentScaledTransform); m_skyNode.setParentLocalTransform(parentLocalTransform); m_skyNode.usesCloudIntegration = usesCloudIntegration; if (m_skyNode.loadFromConfigNode()) { m_skyNode.Init(); if (hasOcean && Scatterer.Instance.mainSettings.useOceanShaders && (HighLogic.LoadedScene != GameScenes.MAINMENU)) { m_oceanNode = (OceanWhiteCaps)Scatterer.Instance.ReturnProperCamera(true, false).gameObject.AddComponent(typeof(OceanWhiteCaps)); m_oceanNode.Init(this); } } }
//this fixes the alt-enter bug the really stupid way but it's fast and simple so it'll do public void reBuildOcean() { if (!ReferenceEquals(m_oceanNode, null)) { m_oceanNode.Cleanup(); Component.Destroy(m_oceanNode); UnityEngine.Object.Destroy(m_oceanNode); m_oceanNode = (OceanWhiteCaps)Scatterer.Instance.ReturnProperCamera(true, false).gameObject.AddComponent(typeof(OceanWhiteCaps)); m_oceanNode.Init(this); if (Scatterer.Instance.mainSettings.oceanRefraction && Scatterer.Instance.bufferManager.refractionTexture.IsCreated()) { Scatterer.Instance.bufferManager.refractionTexture.Create(); } Utils.LogDebug("Rebuilt Ocean"); } }
public void Awake() { if (HighLogic.LoadedScene == GameScenes.MAINMENU) { GameObject _go = Core.GetMainMenuObject(parentCelestialBody.name); if (_go) { MeshRenderer _mr = _go.GetComponent <MeshRenderer> (); if (_mr) { var sctBodyTransform = ScaledSpace.Instance.transform.FindChild(parentCelestialBody.name); m_radius = (_go.transform.localScale.x / sctBodyTransform.localScale.x) * parentCelestialBody.Radius; } } } else { m_radius = parentCelestialBody.Radius; } m_skyNode = (SkyNode)Core.Instance.scaledSpaceCamera.gameObject.AddComponent(typeof(SkyNode)); m_skyNode.setManager(this); m_skyNode.setCelestialBodyName(parentCelestialBody.name); m_skyNode.setParentScaledTransform(parentScaledTransform); m_skyNode.setParentLocalTransform(parentLocalTransform); m_skyNode.usesCloudIntegration = usesCloudIntegration; if (m_skyNode.loadFromConfigNode()) { m_skyNode.Init(); if (hasOcean && Core.Instance.useOceanShaders && (HighLogic.LoadedScene != GameScenes.MAINMENU)) { m_oceanNode = (OceanWhiteCaps)Core.Instance.farCamera.gameObject.AddComponent(typeof(OceanWhiteCaps)); m_oceanNode.setManager(this); m_oceanNode.loadFromConfigNode(); m_oceanNode.Init(); } } }
//this fixes the alt-enter bug the really stupid way but it's fast and simple so it'll do public void reBuildOcean() { if (!ReferenceEquals(m_oceanNode, null)) { m_oceanNode.Cleanup(); Component.Destroy(m_oceanNode); UnityEngine.Object.Destroy(m_oceanNode); m_oceanNode = (OceanWhiteCaps)Core.Instance.farCamera.gameObject.AddComponent(typeof(OceanWhiteCaps)); m_oceanNode.setManager(this); m_oceanNode.loadFromConfigNode(); m_oceanNode.Init(); if (Core.Instance.oceanRefraction && Core.Instance.bufferRenderingManager.refractionTexture.IsCreated()) { Core.Instance.bufferRenderingManager.refractionTexture.Create(); } Debug.Log("[Scatterer] Rebuilt Ocean"); } }
// Initialization public void Awake() { m_radius = parentCelestialBody.Radius; m_skyNode = (SkyNode)Core.Instance.scaledSpaceCamera.gameObject.AddComponent(typeof(SkyNode)); m_skyNode.setManager(this); m_skyNode.usesCloudIntegration = usesCloudIntegration; m_skyNode.SetParentCelestialBody(parentCelestialBody); m_skyNode.setParentPlanetTransform(ParentPlanetTransform); if (m_skyNode.loadFromConfigNode()) { m_skyNode.Init(); if (hasOcean && Core.Instance.useOceanShaders) { m_oceanNode = (OceanWhiteCaps)Core.Instance.farCamera.gameObject.AddComponent(typeof(OceanWhiteCaps)); m_oceanNode.setManager(this); m_oceanNode.loadFromConfigNode(); m_oceanNode.Init(); } } }