private Vector3Int NeighborInDirection(Vector3Int cell, Vector3 direction) { float maxd = float.MinValue; Vector3Int winner = new Vector3Int(); Vector3 c = tilemap.CellToWorld(cell); for (int i = 0; i < 6; i++) { Vector3Int nint = HexagonalTile.GetNeighbor(cell, i); Vector3 n = tilemap.CellToWorld(HexagonalTile.GetNeighbor(cell, i)); float d = Vector3.Dot(direction, n - c); if (d > maxd) { winner = nint; maxd = d; } } return(winner); }