Exemplo n.º 1
0
 private void LoadPlanetAtmosphere(CelestialBodyData newPlanet)
 {
     this.atmosphereRenderer.gameObject.SetActive(newPlanet.atmosphereData.hasAtmosphere);
     this.atmosphereRenderer.transform.localScale = Vector3.one * ((!newPlanet.atmosphereData.hasAtmosphere) ? 1f : ((float)(newPlanet.atmosphereData.atmosphereHeightM * newPlanet.atmosphereData.gradientHightMultiplier + newPlanet.radius)));
     if (newPlanet.atmosphereData.hasAtmosphere)
     {
         Mesh      mesh = this.atmosphereRenderer.GetComponent <MeshFilter>().mesh;
         Vector2[] uv   = mesh.uv;
         uv[0]   = new Vector2(1f + (float)(newPlanet.radius / (newPlanet.atmosphereData.atmosphereHeightM * newPlanet.atmosphereData.gradientHightMultiplier)), 0f);
         mesh.uv = uv;
         this.atmosphereRenderer.sortingLayerName = ((newPlanet.type != CelestialBodyData.Type.Star) ? "Back" : "Default");
         this.atmosphereRenderer.sortingOrder     = ((newPlanet.type != CelestialBodyData.Type.Star) ? 0 : 500);
         this.atmosphereRenderer.sharedMaterial.SetTexture("_MainTex", newPlanet.GenerateAtmosphereTexture());
     }
 }
Exemplo n.º 2
0
 public LowRezPlanet(CelestialBodyData planet)
 {
     PlanetManager.Chunck chunck = new PlanetManager.Chunck(0.0, (double)planet.terrainData.heightMaps[0].heightMap.HeightDataArray.Length, 0, planet, planet.terrainData.detailLevels, null, false, false);
     this.planet                      = planet;
     this.meshHolder                  = chunck.chunckTransform;
     this.meshHolder.localScale       = Vector3.one / 10000f;
     this.meshHolder.gameObject.layer = LayerMask.NameToLayer("Scaled Space");
     this.meshHolder.name             = planet.bodyName + " Scaled";
     this.meshHolder.parent           = Ref.planetManager.scaledHolder;
     if (!planet.atmosphereData.hasAtmosphere)
     {
         return;
     }
     PlanetManager.LowRezPlanets.LowRezPlanet.CreateAtmosphere(this.meshHolder, planet, planet.atmosphereData.gradientHightMultiplier, "Scaled Space", (planet.type != CelestialBodyData.Type.Star) ? "Back" : "Default", (planet.type != CelestialBodyData.Type.Star) ? 0 : 500, planet.GenerateAtmosphereTexture());
 }