internal void Destroy() { GameObject.DestroyImmediate(translator); foreach (VolumeSection vs in VolumeList) { vs.Destroy(); } CloudLayer.Log("Volume Destroyed"); }
public VolumeManager(float cloudSphereRadius, Texture2D texture, Material cloudParticleMaterial, Transform transform) : this(cloudSphereRadius, transform) { atmosphere = false; VolumeList.Add(new VolumeSection(texture, cloudParticleMaterial, transform, Center.localPosition, Magnitude, new Vector3(-radius, 0, 0), radius, divisions)); VolumeList.Add(new VolumeSection(texture, cloudParticleMaterial, transform, Center.localPosition, Magnitude, new Vector3(halfRad, 0, opp), radius, divisions)); VolumeList.Add(new VolumeSection(texture, cloudParticleMaterial, transform, Center.localPosition, Magnitude, new Vector3(halfRad, 0, -opp), radius, divisions)); forceUpdate = true; CloudLayer.Log("Volume Initialized"); }
private void MacroCallback(bool isNotScaled) { if (volume != null) { volume.Enabled = isNotScaled; CloudLayer.Log("Volume Enabled=" + isNotScaled); } else if (volume == null && isNotScaled) { volume = new VolumeManager(CloudOverlay.Radius, (Texture2D)this.mainTexture.Texture, CloudParticleMaterial, this.CloudOverlay.Transform); } }
private void LoadConfigNode(ConfigNode node, string url, bool useVolume, bool defaults) { //Debug.Log("LoadConfigNode Called"); Called on MainMenu ConfigNode loadNode = node.GetNode("SAVED"); if ((loadNode == null || defaults) && node.HasNode("DEFAULTS")) { loadNode = node.GetNode("DEFAULTS"); loadNode.RemoveValue("REMOVED"); } else if (node.HasValue("REMOVED") && bool.Parse(node.GetValue("REMOVED"))) { return; } else if (defaults && !node.HasNode("DEFAULTS")) { node.AddValue("REMOVED", true); return; } String body = loadNode.GetValue("body"); Transform bodyTransform = null; try { bodyTransform = ScaledSpace.Instance.scaledSpaceTransforms.Single(t => t.name == body); } catch { } if (bodyTransform != null) { float altitude = float.Parse(loadNode.GetValue("altitude")); TextureSet mTexture = new TextureSet(loadNode.GetNode("main_texture"), false); TextureSet dTexture = new TextureSet(loadNode.GetNode("detail_texture"), false); ConfigNode floatsConfig = loadNode.GetNode("shader_floats"); ShaderFloats shaderFloats = null; if (floatsConfig != null) { shaderFloats = new ShaderFloats(floatsConfig); } ConfigNode scaledfloatsConfig = loadNode.GetNode("scaled_shader_floats"); ShaderFloats scaledShaderFloats = null; if (scaledfloatsConfig != null) { scaledShaderFloats = new ShaderFloats(scaledfloatsConfig); } ConfigNode colorNode = loadNode.GetNode("color"); Color color = new Color( float.Parse(colorNode.GetValue("r")), float.Parse(colorNode.GetValue("g")), float.Parse(colorNode.GetValue("b")), float.Parse(colorNode.GetValue("a"))); if (useVolume) { bool.TryParse(loadNode.GetValue("volume"), out useVolume); } CloudLayer.Layers.Add( new CloudLayer(url, node, body, color, altitude, mTexture, dTexture, scaledShaderFloats, shaderFloats, useVolume)); } else { CloudLayer.Log("body " + body + " does not exist!"); } }