Created
October 24, 2023 20:40
-
-
Save general-games/79a3fb164298cd59e3964199c4c77d8d to your computer and use it in GitHub Desktop.
Removing invalid cells from movement path
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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