Ejemplo n.º 1
0
    public static bool CityEdgesCheck(List <HexEdgeData> visited, HexEdgeData edge)
    {
        visited.Add(edge);

        var clockwiseEdge     = HexUtils.GetClockwiseEdge(edge.MyHexTile, edge, 1);
        var antiClockwiseEdge = HexUtils.GetClockwiseEdge(edge.MyHexTile, edge, -1);

        if (!CityEdgeCheck(visited, edge.HexEdgeType, clockwiseEdge))
        {
            return(false);
        }

        if (!CityEdgeCheck(visited, edge.HexEdgeType, antiClockwiseEdge))
        {
            return(false);
        }

        if (edge.IsOpen)
        {
            var connected = HexUtils.GetConnectedEdge(edge.MyHexTile, edge);

            if (connected.MyHexTile.Owner != Player.MyPlayer)
            {
                return(false);
            }

            if (!CityEdgeCheck(visited, edge.HexEdgeType, connected))
            {
                return(false);
            }
        }

        return(true);
    }