I thought the path it found was very dull and did not feel like the enemy was moving “towards” the objective so I did this:
Change the directions array to a list:
List< Vector2Int > directions = new List < Vector2Int >
{
Vector2Int.up,
Vector2Int.right,
Vector2Int.down,
Vector2Int.left
};
Then reversed the list every time ExploreNeighbours() was called:using:
directions.reverse()
This makes for a much more interesting path which still seems to find the most efficient path to the end.
Are there any potential problems with this method?