Пример #1
0
    void TriangulateConnection(HexCell cell, HexDirections direction, Vector3 v1, Vector3 v2)
    {
        HexCell neighbor = cell.GetNeighbors(direction);

        if (neighbor == null)
        {
            return;
        }

        Vector3 bridge = HexMetrics.GetBridge(direction);
        Vector3 v3     = v1 + bridge;
        Vector3 v4     = v2 + bridge;

        v3.y = v4.y = neighbor.Elevation * HexMetrics.elevationStep;

        TriangulateConnectionTerrace(v1, v2, cell, v3, v4, neighbor);

        // Add triagles betwen bridges.
        HexCell nextNeighbor = cell.GetNeighbors(direction.Next());

        if (direction <= HexDirections.E && nextNeighbor != null)
        {
            Vector3 v5 = v2 + HexMetrics.GetBridge(direction.Next());
            v5.y = nextNeighbor.Elevation * HexMetrics.elevationStep;

            AddTriangle(v2, v4, v5);
            AddTriangleColor(cell.color, neighbor.color, nextNeighbor.color);
        }
    }