コード例 #1
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]]);
    }
コード例 #2
0
    public bool IsNeighborOfTile(HexTile otherTile)
    {
        foreach (var diraction in Utils.EnumUtil.GetValues <HexDiraction>())
        {
            var checkTileLocation = Data.GetVector() + HexEdgeOffset[diraction];
            var checkTile         = GridManager.Singleton.GetHex(checkTileLocation);

            if (checkTile == null)
            {
                continue;
            }

            if (checkTile == otherTile)
            {
                return(true);
            }
        }

        return(false);
    }