void Start() { destinationPosition = destination.transform.position; agentPosition = agent.transform.position; nodesGenerator.genNodesGrid(ref nodeGrid); nodesGenerator.SetNearestNode(ref nodeGrid, ref agentPosition, ref originNode); Debug.Log("ORIGIN: " + originNode.position); nodesGenerator.SetNearestNode(ref nodeGrid, ref destinationPosition, ref goalNode); currentNode = originNode; openedNodes.Add(currentNode); pathToGoal.Add(destinationPosition); switch (pathFindingType) { case TypeOfPathFinding.BreadthFirstSearch: breadthFirstSearch.BFS(ref currentNode, ref openedNodes, ref goalNode, ref goalFound); break; case TypeOfPathFinding.DepthFirstSearch: depthFirstSearch.DFS(ref currentNode, ref openedNodes, ref goalNode, ref goalFound); break; case TypeOfPathFinding.Dijkstra: dijkstra.DijkstraAlgorithm(ref currentNode, ref openedNodes, ref goalNode, ref goalFound); break; case TypeOfPathFinding.AStar: aStar.AStarAlgorithm(ref currentNode, ref openedNodes, ref goalNode, ref goalFound); break; default: break; } }