public void GetGoalPosition() { UpdateStartPosition(); StartNode = new Node2D( GridManager2D.Instance.GetGridCellCenter(GridManager2D.Instance.GetGridIndex(_startPos))); GoalNode = new Node2D( GridManager2D.Instance.GetGridCellCenter(GridManager2D.Instance.GetGridIndex(_player.transform.position))); _pathArray = AStar2D.FindPath(StartNode, GoalNode); }
private void GetGoalPosition(Vector2 startPosition) { StartNode = new Node2D( GridManager2D.Instance.GetGridCellCenter(GridManager2D.Instance.GetGridIndex(startPosition))); var mousePos = GetMouseInput(); GoalNode = new Node2D( GridManager2D.Instance.GetGridCellCenter(GridManager2D.Instance.GetGridIndex(mousePos))); if (GoalNode.position.y < 1f) { GoalNode = StartNode; } _pathArray = AStar2D.FindPath(StartNode, GoalNode); }