Example #1
0
    public World Initialize(bool loadWorld = false)
    {
        simplex = new SimplexNoise(GameManager.gameSeed);
        octaves = Random.Range(4, 4);
        multiplier = Random.Range(10, 10);
        amplitude = Random.Range(0.6f, 1f);
        lacunarity = Random.Range(0.7f, .9f);
        dAmplitude = Random.Range(0.5f, .1f);

        if (loadWorld)
        {
          activeWorld = LoadWorld();
        }
        else
        {
          activeWorld = new World();
          activeWorld.PrepForCache(worldScale, worldSubdivisions);
        }

        //Seed the world heights
        SetHeights();

        //CreateOcean();

        currentWorldObject = new GameObject("World");
        currentWorldTrans = currentWorldObject.transform;

        //currentWorld = new World(WorldSize.Small, WorldType.Verdant, Season.Spring, AxisTilt.Slight);

        worldRenderer = GetComponent<WorldRenderer>();
        //changed this to run RenderPlates instead of RenderWorld
        foreach (GameObject g in worldRenderer.RenderPlates(activeWorld, regularTileSet))
        {
          g.transform.parent =currentWorldTrans;
        }

        //layermask = 1 << 8;   // Layer 8 is set up as "Chunk" in the Tags & Layers manager

        labelDirections = true;

        //DrawHexIndices();

        return activeWorld;
    }