Exemplo n.º 1
0
    private void TriangulateConnection(HexDirection direction, HexCell cell, Vector3 v1, Vector3 v2)
    {
        HexCell neighbor = cell.GetNeighbour(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;

        HexCell nextNeighbor = cell.GetNeighbour(direction.NextDirection());

        if (nextNeighbor != null && direction <= HexDirection.E)
        {
            Vector3 v5 = v2 + HexMetrics.GetBridge(direction.NextDirection());
            v5.y = nextNeighbor.Elevation * HexMetrics.elevationStep;
            AddTriangle(v2, v4, v5);
            AddTriangleColor(cell.color, neighbor.color, nextNeighbor.color);
        }

        /*
         * if (cell.GetNeighbourSlopeType(direction) == HexSlopeType.Slope)
         * {
         *  TriangulateTerraces(v1, v2, v3, v4, cell, neighbor);
         * }
         * else
         * {
         *  AddQuad(v1, v2, v3, v4);
         *  AddQuadColor(cell.color, neighbor.color);
         * }
         */

        AddQuad(v1, v2, v3, v4);
        AddQuadColor(cell.color, neighbor.color);
    }