コード例 #1
0
        public override Chunk CreateChunk(Vector2 pos)
        {
            Chunk c = new Chunk(pos);

            float[,] noiseMap = Perlin.InterprolateNoise(pos);

            RenderStructure ground = new RenderStructure(Chunk.CHUNK_TILE_WIDTH, Chunk.CHUNK_TILE_HEIGHT);

            for (int x = 0; x < Chunk.CHUNK_TILE_WIDTH; x++)
            {
                for (int y = 0; y < Chunk.CHUNK_TILE_WIDTH; y++)
                {
                    int z  = (int)noiseMap[x, y];
                    int id = (z > 3) ? 1 : 0;
                    ground.structuralUnits[x][y] = new RenderUnit(id, 0, new Vector3(x, y, z));
                }
            }

            c.AddStructure(ground);

            return(c);
        }