AStarTest.MapControl.GetPathReverse C# (CSharp) Method

GetPathReverse() public method

public GetPathReverse ( AStarNode lastNode ) : IEnumerable
lastNode Dwarrowdelf.AStarNode
return IEnumerable
        public IEnumerable<Direction> GetPathReverse(AStarNode lastNode)
        {
            if (lastNode == null)
                yield break;

            AStarNode n = lastNode;
            while (n.Parent != null)
            {
                yield return (n.Parent.Loc - n.Loc).ToDirection();
                n = n.Parent;
            }
        }