Exemple #1
0
    public static HexEdgeData GetClockwiseEdge(HexTileData hexTileData, HexEdgeData currentHex, int index)
    {
        var size     = currentHex.MyHexTile.HexEdgesData.Count;
        var newIndex = ((int)currentHex.HexDiraction + size + index) % size;

        return(hexTileData.HexEdgesData[newIndex]);
    }
Exemple #2
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);
    }
Exemple #3
0
    public static HexEdgeData GetConnectedEdge(HexTileData hexTileData, HexEdgeData edgeData)
    {
        var hexDiraction = edgeData.HexDiraction;
        var hexTile      = GridManager.Singleton.GetHex(hexTileData.GetVector());
        var nieghborTile = GetNeighborTile(hexTile, hexDiraction);

        if (nieghborTile == null)
        {
            return(null);
        }

        return(nieghborTile.Data.HexEdgesData[(int)HexUtils.OppsiteHex[hexDiraction]]);
    }
Exemple #4
0
 public static Price CalcHexEdgePrice(HexEdgeData hexEdgeData)
 {
     return(Configuration.Singleton.GetPriceOfType(hexEdgeData.HexEdgeType));
 }
Exemple #5
0
 public static bool CityEdgeCheck(List <HexEdgeData> visited, HexEdgeType hexEdgeType, HexEdgeData edge)
 {
     if (!visited.Contains(edge) &&
         edge.HexEdgeType == hexEdgeType)
     {
         if (!CityEdgesCheck(visited, edge))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #6
0
    public static List <HexEdgeData> CityCompleteCheck(HexTile hexTile, HexEdgeData edgeDate)
    {
        var visited = new List <HexEdgeData>();//will check if the city is complete

        return(visited);
    }
Exemple #7
0
 public void Init(HexEdgeData hexEdgeData)
 {
     HexEdgeData = hexEdgeData;
 }