Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
 void Awake()
 {
     pathCalculator = new AStarCalculator(gameWorldBaseGrid);
 }