예제 #1
0
    public void TriangulateAllCells()
    {
        // This method could be invoked at any time, even when cells have already been triangulated earlier.
        // So we should begin by clearing the old data.
        Terrain.Clear();
        Rivers.Clear();
        Roads.Clear();
        Water.Clear();
        WaterShore.Clear();
        Estuaries.Clear();
        Features.Clear();

        for (int i = 0; i < _cells.Length; i++)
        {
            Precalculation(_cells[i]);
        }

        for (int i = 0; i < _cells.Length; i++)
        {
            TriangulateCell(_cells[i]);
            AddFeatures(_cells[i]);
        }

        Terrain.Apply();
        Rivers.Apply();
        Roads.Apply();
        Water.Apply();
        WaterShore.Apply();
        Estuaries.Apply();
        Features.Apply();
    }
 /// <summary>
 /// Builds the mesh of the hex grid out of the provided array of cells.
 /// </summary>
 public void Triangulate()
 {
     Terrain.Clear();
     Rivers.Clear();
     Roads.Clear();
     Water.Clear();
     WaterShore.Clear();
     Estuaries.Clear();
     Features.Clear();
     for (int i = 0; i < Cells.Length; i++)
     {
         Triangulate(Cells[i]);
     }
     Terrain.Apply();
     Rivers.Apply();
     Roads.Apply();
     Water.Apply();
     WaterShore.Apply();
     Estuaries.Apply();
     Features.Apply();
 }
        public void Triangulate(HexCell[] cells)
        {
            Terrain.Clear();
            Rivers.Clear();
            Roads.Clear();
            Water.Clear();
            WaterShore.Clear();
            Estuaries.Clear();
            Features.Clear();

            foreach (var cell in cells)
            {
                TriangulateCell(cell);
            }

            Terrain.Apply();
            Rivers.Apply();
            Roads.Apply();
            Water.Apply();
            WaterShore.Apply();
            Estuaries.Apply();
            Features.Apply();
        }