Beispiel #1
0
    private void GeneratePlanet(int width, int height)
    {
        Texture2D planetTex = new Texture2D(width, height, TextureFormat.ARGB32, false);
        Texture2D cloudsTex = new Texture2D(width, height, TextureFormat.ARGB32, false);

        if (pg == null)
        {
            pg = new PlanetGenerator(width, height, true);
        }
        pg.generatePlanet(planetInfo);
        cloudsTex.SetPixels(pg.GetCloudColors());
        cloudsTex.Apply();


        GameObject clouds = GameObject.Find("Clouds");

        if (clouds != null)
        {
            clouds.renderer.material.mainTexture = cloudsTex;
        }

        SetWater(planetInfo.colorRamp.gradient [0]);


        planetTex.SetPixels(pg.GetPlanetColors());
        planetTex.Apply();
        renderer.material.mainTexture = planetTex;
        pg.Finished();
    }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     if (pgThread.IsReady())
     {
         rogueMP.SetPlanet(width, height, pgThread.GetPlanetColors(), pgThread.GetPlanetInfo());
         pgThread.Finished();
         Invoke("StartRandomPlanet", 3);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (planet != null)
     {
         planet.transform.RotateAround(planet.transform.position, Vector3.up, Time.deltaTime * 5);
     }
     if (pg.IsReady())
     {
         mp.SetPlanet(width, height, pg.GetPlanetColors(), pg.GetPlanetInfo());
         float size = (float)mp.planetInfo.planetSize * .016f;
         mp.transform.localScale = new Vector3(size, size, size);
         pg.Finished();
     }
 }