Skip to content

Commit 60f4fd9

Browse files
committed
check neighbor instead of current cell in pathfinding
1 parent 4f4c7e2 commit 60f4fd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Pacification/Assets/Scripts/Map/HexGrid.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ bool SearchPath(HexCell start, HexCell end, int speed)
180180
{
181181
HexCell neighbor = current.GetNeighbor(dir);
182182
if(neighbor == null || neighbor.Distance != int.MaxValue ||
183-
!current.IsReachable(dir) || current.IsUnderWater)
183+
!current.IsReachable(dir) || neighbor.IsUnderWater)
184184
continue;
185185

186186
// Road and flat terrains are faster than cliffs

0 commit comments

Comments
 (0)