private void SearchShortestPath() { Location start = new Location((int)player.transform.position.x, (int)player.transform.position.y); Location goal = new Location((int)worldPoint.x, (int)worldPoint.y); AStarSearch astar = new AStarSearch(); path = astar.AStar(grid, start, goal); }
private void SearchShortestPath() { Location start = new Location((int)enemy.transform.position.x, (int)enemy.transform.position.y); Location goal = new Location((int)targetPosition.x, (int)targetPosition.y); AStarSearch astar = new AStarSearch(); path = astar.AStar(ClickMove.grid, start, goal); }
private void SnakePath(GridTile target) { if (_movingCoroutine != null) { StopCoroutine(_movingCoroutine); _movingCoroutine = null; } _movingCoroutine = StartCoroutine(MoveSnakeAStar(_snake, AStarSearch.AStar(GameManager.GameGrid.GetTile(_snake.position), target, _dir), target)); }
void Search() { if (visible) { PositionSearchProblem problem = new PositionSearchProblem(transform.position, target.transform.position, colliderSize, 1, 0, followDistance); path = AStarSearch <Vector2Int, Vector2Int> .AStar(problem); GetNextPoint(transform.position); enemy.Play(); } Invoke("Search", secondsBetweenAI); }
void Search() { if (Visible) { SightlineSearchProblem problem = new SightlineSearchProblem(transform.position, target.transform.position, colliderSize, 1, 0, sightDistance); path = AStarSearch <Vector2Int, Vector2Int> .AStar(problem); enemy.Play(); if (path.Count > 0) { SeekState(); } else { FoundState(); } GetNextPoint(transform.position); } Invoke("Search", secondsBetweenAI); }