private void Start() { Func <GraphNode <RoadNode>, GraphNode <RoadNode>, float> heuristicCalc = (node1, node2) => { return(Vector3.Distance(node1.Value.Position, node2.Value.Position)); }; astarCalc = new AStarCalculator <RoadNode>(roadGraph, heuristicCalc); }
private void SetNewMovementPath(Character character) { var startLocation = this.character.GetLocation().ToVec2(); var targetLocation = new Vector2Int(2, 1); AStarCalculator aStarCalculator = new AStarCalculator(gameWorldGrid); var result = aStarCalculator.FindShortestPath(startLocation, new List <Vector2Int> { targetLocation }, null); character.SetMovementPath(result); gameWorld.DisplayPathOverlay(result); }
void Awake() { pathCalculator = new AStarCalculator(gameWorldBaseGrid); }