AStarPathFinding.AStar.CalculatePath C# (CSharp) Method

CalculatePath() public method

public CalculatePath ( ) : void
return void
        public void CalculatePath()
        {
            var firstNode = new Node(_map.StartCell, null);
            _openList.Add(firstNode);
            _currentNode = firstNode;

            while(true)
            {
                if (_openList.Count == 0)
                {
                    break;
                }

                _currentNode = FindSmallestF();
                if (_currentNode.CellIndex == _map.TargetCell)
                {
                    break;
                }

                _openList.Remove(_currentNode);
                _closedList.Add(_currentNode);

                AddAdjacentCellToOpenList(_currentNode, -1, -1, 14);
                AddAdjacentCellToOpenList(_currentNode, 0, -1, 10);
                AddAdjacentCellToOpenList(_currentNode, 1, -1, 14);
                AddAdjacentCellToOpenList(_currentNode, -1, 0, 10);
                AddAdjacentCellToOpenList(_currentNode, 1, 0, 10);
                AddAdjacentCellToOpenList(_currentNode, -1, 1, 14);
                AddAdjacentCellToOpenList(_currentNode, 0, 1, 10);
                AddAdjacentCellToOpenList(_currentNode, 1, 1, 14);
            }

            _map.HighlightPath(_currentNode);
        }