Skip to content

Instantly share code, notes, and snippets.

@general-games
Created October 24, 2023 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save general-games/79a3fb164298cd59e3964199c4c77d8d to your computer and use it in GitHub Desktop.
Save general-games/79a3fb164298cd59e3964199c4c77d8d to your computer and use it in GitHub Desktop.
Removing invalid cells from movement path
//Add this code at line 56-57 in the MovementAction Script
//Calculate all paths and add to movementPaths
var invalidPathCells = gameGrid.cells.Where(c => !validation.Validate(c, this));
var (distances, previous) = new Dijkstra<Cell>().GetPaths(gameGrid.Graph, invalidPathCells.Select(c => c.gridPosition.index).ToArray() ,gameGrid.Size, Entity.GridPosition.index);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment