public void AlignEdges(HeightMap leftNeighbor, HeightMap rightNeighbor,
                HeightMap topNeighbor, HeightMap bottomNeighbor, int shift = 0)
        {
            int x, y, counter;
            float[][] nHeights;

            int size = this.Size;

            if (leftNeighbor != null)
            {
                nHeights = leftNeighbor.GetOverlappedHeights();
                counter = 0;

                for (x = size + Overlap - shift; x < size + (Overlap * 2); x++)
                {
                    for (y = 0; y < size; y++)
                    {
                        _heights[counter][y] = nHeights[x][y];
                    }

                    counter++;
                }

                x = size - 1;

                for (y = 0; y < size; y++)
                {
                    this[0, y] = leftNeighbor[x, y];
                }
            }
            if (rightNeighbor != null)
            {
                nHeights = rightNeighbor.GetOverlappedHeights();
                counter = 0;

                for (x = size + Overlap - shift; x < size + (Overlap * 2); x++)
                {
                    for (y = 0; y < size; y++)
                    {
                        _heights[x][y] = nHeights[counter][y];
                    }

                    counter++;
                }

                x = size - 1;

                for (y = 0; y < size; y++)
                {
                    this[x, y] = rightNeighbor[0, y];
                }
            }
            if (topNeighbor != null)
            {
                nHeights = topNeighbor.GetOverlappedHeights();
                counter = 0;

                for (y = size + Overlap - shift; y < size + (Overlap * 2); y++)
                {
                    for (x = 0; x < size; x++)
                    {
                        _heights[x][y] = nHeights[x][counter];
                    }

                    counter++;
                }

                y = size - 1;

                for (x = 0; x < size; x++)
                {
                    this[x, y] = topNeighbor[x, 0];
                }
            }
            if (bottomNeighbor != null)
            {
                nHeights = bottomNeighbor.GetOverlappedHeights();
                counter = 0;

                for (y = size + Overlap - shift; y < size + (Overlap * 2); y++)
                {
                    for (x = 0; x < size; x++)
                    {
                        _heights[x][counter] = nHeights[x][y];
                    }

                    counter++;
                }

                y = size - 1;

                for (x = 0; x < size; x++)
                {
                    this[x, 0] = bottomNeighbor[x, y];
                }
            }
        }
        private HeightMap CreateHeightMap(GameStartupSettings settings)
        {
            HeightMap heightmap = new HeightMap(256, HeightMap.Overlap / 2, HeightMap.Overlap / 2);

            heightmap.MakeFlat(0.1f);
            heightmap.SetNoise(0.22f); // 0.3 makes smaller structure, 0.1 makes blobs
            heightmap.Erode(10);
            heightmap.Smoothen();
            //heightmap.Smoothen();

            return heightmap;
        }