Exemplo n.º 1
0
            public void GenerateChunk()
            {
                int[,] temp = new int[XSize, YSize];

                for (int x = 0; x < XSize; x++)
                {
                    for (int y = 0; y < YSize; y++)
                    {
                        int num = Random.Range(0, 100);
                        if (num >= 35)
                        {
                            num = 3;
                        }
                        else if (num > 25)
                        {
                            num = 0;
                        }
                        else
                        {
                            num = 1;
                        }
                        temp[x, y] = num;
                    }
                }
                temp = CreateMap.CellularAutomata(temp, XSize, YSize, 0, 2, 1, true);

                int cnt = 0;

                foreach (Chunk chunk in Chunks)
                {
                    chunk.GenerateTile((eGeoType)temp[cnt % XSize, cnt / XSize]);
                    cnt++;
                }
            }
Exemplo n.º 2
0
            public void Smoothing()
            {
                int[,] nGeo = new int[nXSize * 8, nYSize * 8];
                foreach (TileData tile in TileList)
                {
                    nGeo[tile.X, tile.Y] = tile.Height;
                }

                nGeo = CreateMap.CellularAutomata(nGeo, nXSize * 8, nYSize * 8, 2, 2, 4, true);

                foreach (TileData tile in TileList)
                {
                    tile.Height = nGeo[tile.X, tile.Y];
                    tile.CoverDirt();
                }
            }