Esempio n. 1
0
 public void GenerateIcosphere()
 {
     icos = new Icosphere();
     icos.Subdivide(mapSubdivisions);
     map = new TileMap(icos, mapSettings, tileSettings);
     icos.Subdivide(meshSubdivisions);
 }
Esempio n. 2
0
    public Planet(Vector3 center, float radius, int divisions, float scale)
    {
        // We make sure the radius of the planet will work as intendad.
        if (radius <= 1)
        {
            radius = 1;
            Debug.LogWarning("The radius can't be smaller than 1.0f.");
        }

        // We make sure resizing the planet will work as intendad.
        if (scale <= 0)
        {
            scale = 0.1f;
            Debug.LogWarning("The scale can't be smaller than 0.1f.");
        }

        // Prevent the mesh to overflow.
        if (divisions > 6)
        {
            divisions = 6;
            Debug.LogWarning("Can't divide a planet more than 6 times.");
        }

        // We Generate the Basic Icosphere points and triangles.
        ico = new Icosphere(center, radius);

        // We divide the icosphere n times(add smoothness).
        Thread t = new Thread(() => generated = ico.Subdivide(divisions));

        t.Start();
    }