Exemplo n.º 1
0
    /// <summary>
    /// 찾은 길을 거꾸로 올라가는 함수.
    /// </summary>
    /// <param name="startNode"></param>
    /// <param name="endNode"></param>
    /// <returns></returns>
    private CellClass[] RetracePath(CellClass startNode, CellClass endNode)
    {
        List <CellClass> path        = new List <CellClass>();
        CellClass        currentNode = endNode;

        while (currentNode != startNode)
        {
            path.Add(currentNode);
            currentNode = currentNode.GetParent();
        }

        path.Reverse();
        path.Insert(0, startNode);

        return(path.ToArray());
    }