public void StratPathFindinAlgorithm() { pathFind.interactable = false; resetCurrentPath.interactable = true; clearAll.interactable = true; gridController.PathGridState = PathGridState.PathFind; gridController.InitGraf(); Vector2Int goalPosition = new Vector2Int(gridController.GoalPos.x, gridController.GoalPos.y); Vector2Int startPosition = new Vector2Int(gridController.StartPos.x, gridController.StartPos.y); IHeuristicEstimate heuristic = HeuristicFactory.СreateHeuristic(heuristicType, breakerType, startPosition, float.Parse(heuristicCoeffField.text)); float timeDelay = float.Parse(delayBeforeSteps.text); AStarAlgorithm algorithm = new AStarAlgorithm(gridMarkerController, heuristic, timeDelay); pathFindingAlgorithmCoroutine = StartCoroutine(algorithm.FindPath(gridController.GetStartVertex(), gridController.GetGoalVertex())); }
public void StratPathFindinAlgorithm() { OnPathSearchState(); gridController.InitGraf(); Vector2Int goalPosition = new Vector2Int(gridController.GoalPos.x, gridController.GoalPos.y); Vector2Int startPosition = new Vector2Int(gridController.StartPos.x, gridController.StartPos.y); IHeuristicEstimate heuristic = HeuristicFactory.СreateHeuristic(HeuristicType.Manhattan, TieBreakerType.None, startPosition, 1); float timeDelay = float.Parse(delayBeforeSteps.text); float moveTimeDelay = float.Parse(delayBeforeMove.text); DStarLiteAlgorithm algorithm = new DStarLiteAlgorithm(gridMarkerController, gridController.Graph, heuristic, timeDelay); gridController.OnVerteciesUpdate = (vertecies) => { vertecies.ForEach(v => algorithm.UpdatePath(v)); }; pathFindingAlgorithmCoroutine = StartCoroutine(algorithm.MoveByPath(gridController.GetStartVertex(), gridController.GetGoalVertex(), OnPathSearchState, OnStartMove)); }