Class PathFinding2D
A* algorithm, used by GameCharacter to move through the BattleGrid. This script is a modification of UnityPathFinding2D, under MIT license. The original script can be found at: https://github.com/folospace/UnityPathFinding2D
Namespace: AutoBattleFramework.Movement
Assembly: cs.temp.dll.dll
Syntax
public class PathFinding2D
Methods
find(GridCell, GridCell, Battle, Boolean)
Get the path from an initial cell to a target cell.
Declaration
public static List<GridCell> find(GridCell from, GridCell to, Battle battle, bool GetPathWithoutObstacles = false)
Parameters
Type | Name | Description |
---|---|---|
GridCell | from | Initial cell |
GridCell | to | Target cell |
Battle | battle | Current battle |
Boolean | GetPathWithoutObstacles | Optional parameter. Set it to true to ignore other GameCharacters. Useful to find the distance between cells. |
Returns
Type | Description |
---|---|
List<GridCell> | List of cells that build a path from the initial to the final cell. |
FindNeighbors4x(GridCell, BattleGrid)
Find the neighbors cells of a given cell, used in Squared grid types.
Declaration
public static List<GridCell> FindNeighbors4x(GridCell cell, BattleGrid grid)
Parameters
Type | Name | Description |
---|---|---|
GridCell | cell | Cell to look for neighbors. |
BattleGrid | grid | Current grid of cells. |
Returns
Type | Description |
---|---|
List<GridCell> | List of neighbor cells. |
FindNeighbors6x(GridCell, BattleGrid)
Find the neighbors cells of a given cell, used in Hex grid types.
Declaration
public static List<GridCell> FindNeighbors6x(GridCell cell, BattleGrid grid)
Parameters
Type | Name | Description |
---|---|---|
GridCell | cell | Cell to look for neighbors. |
BattleGrid | grid | Current grid of cells. |
Returns
Type | Description |
---|---|
List<GridCell> | List of neighbor cells. |