ctac.MapService.ReconstructPath C# (CSharp) Method

ReconstructPath() private method

private ReconstructPath ( Tile>.Dictionary came_from, Tile current ) : List
came_from Tile>.Dictionary
current Tile
return List
        private List<Tile> ReconstructPath(Dictionary<Tile, Tile> came_from, Tile current)
        {
            var total_path = new List<Tile>() { current };
            while( came_from.ContainsKey(current)){
                current = came_from[current];
                total_path.Add(current);
            }
            total_path.Reverse();
            //remove starting tile
            return total_path.Skip(1).ToList();
        }