Esempio n. 1
0
    void TriangulateOpenWater(HexDirection direction, HexCell_Script cell, HexCell_Script neighbor,
                              Vector3 center)
    {
        Vector3 c1 = center + HexMetrics_Script.GetFirstWaterCorner(direction);
        Vector3 c2 = center + HexMetrics_Script.GetSecondWaterCorner(direction);

        water.AddTriangle(center, c1, c2);

        if (direction <= HexDirection.SE && neighbor != null)
        {
            Vector3 bridge = HexMetrics_Script.GetWaterBridge(direction);
            Vector3 e1     = c1 + bridge;
            Vector3 e2     = c2 + bridge;

            water.AddQuad(c1, c2, e1, e2);

            if (direction <= HexDirection.E)
            {
                HexCell_Script nextNeighbor = cell.GetNeighbor(direction.Next());
                if (nextNeighbor == null || !nextNeighbor.IsUnderwater)
                {
                    return;
                }

                water.AddTriangle(c2, e2, c2 + HexMetrics_Script.GetWaterBridge(direction.Next()));
            }
        }
    }