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]]); }
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); }