Exemple #1
0
    public void Triangulate(
        HexMap hexMap,
        float hexOuterRadius,
        HexAdjacencyGraph adjacencyGraph,
        RiverDigraph riverGraph,
        RoadUndirectedGraph roadGraph,
        ElevationDigraph elevationGraph
        )
    {
        _terrainLayer.Clear();
        _riversLayer.Clear();
        _roadsLayer.Clear();
        _openWaterLayer.Clear();
        _waterShoreLayer.Clear();
        _estuariesLayer.Clear();
        _features.Clear();

        for (int i = 0; i < Hexes.Length; i++)
        {
            Hex current = Hexes[i];

            if (current)
            {
                Dictionary <HexDirections, Hex> neighbors =
                    adjacencyGraph.GetNeighborByDirection(current);

                Dictionary <HexDirections, ElevationEdgeTypes> edgeTypes =
                    elevationGraph.GetNeighborEdgeTypes(current);

                Dictionary <HexDirections, bool> roadEdges =
                    roadGraph.GetNeighborRoads(current);

                List <HexDirections> borderDirections =
                    adjacencyGraph.GetBorderDirectionsList(current);

                HexRiverData riverData = riverGraph.GetRiverData(current);

                TriangulateHex(
                    current,
                    neighbors,
                    borderDirections,
                    hexOuterRadius,
                    riverData,
                    roadEdges,
                    edgeTypes,
                    hexMap.WrapSize,
                    _terrainLayer,
                    _riversLayer,
                    _roadsLayer,
                    _openWaterLayer,
                    _waterShoreLayer,
                    _estuariesLayer,
                    _features
                    );
            }
        }

        _terrainLayer.Draw();
        _riversLayer.Draw();
        _roadsLayer.Draw();
        _openWaterLayer.Draw();
        _waterShoreLayer.Draw();
        _estuariesLayer.Draw();
        _features.Apply();
    }