mirror of
https://github.com/DerTyp7/grow-ai-unity.git
synced 2025-10-30 21:07:09 +01:00
better pathfinding
This commit is contained in:
@@ -105,17 +105,17 @@ public class Pathfinding {
|
||||
// Left
|
||||
neighbourList.Add(GetNode(currentNode.x - 1, currentNode.y));
|
||||
// Left Down
|
||||
if (currentNode.y - 1 >= 0) neighbourList.Add(GetNode(currentNode.x - 1, currentNode.y - 1));
|
||||
// if (currentNode.y - 1 >= 0) neighbourList.Add(GetNode(currentNode.x - 1, currentNode.y - 1));
|
||||
// Left Up
|
||||
if (currentNode.y + 1 < grid.GetHeight()) neighbourList.Add(GetNode(currentNode.x - 1, currentNode.y + 1));
|
||||
// if (currentNode.y + 1 < grid.GetHeight()) neighbourList.Add(GetNode(currentNode.x - 1, currentNode.y + 1));
|
||||
}
|
||||
if (currentNode.x + 1 < grid.GetWidth()) {
|
||||
// Right
|
||||
neighbourList.Add(GetNode(currentNode.x + 1, currentNode.y));
|
||||
// Right Down
|
||||
if (currentNode.y - 1 >= 0) neighbourList.Add(GetNode(currentNode.x + 1, currentNode.y - 1));
|
||||
// if (currentNode.y - 1 >= 0) neighbourList.Add(GetNode(currentNode.x + 1, currentNode.y - 1));
|
||||
// Right Up
|
||||
if (currentNode.y + 1 < grid.GetHeight()) neighbourList.Add(GetNode(currentNode.x + 1, currentNode.y + 1));
|
||||
// if (currentNode.y + 1 < grid.GetHeight()) neighbourList.Add(GetNode(currentNode.x + 1, currentNode.y + 1));
|
||||
}
|
||||
// Down
|
||||
if (currentNode.y - 1 >= 0) neighbourList.Add(GetNode(currentNode.x, currentNode.y - 1));
|
||||
|
||||
Reference in New Issue
Block a user