private static List <WorldCell> CreatePath(WorldCell endCell) { var path = new List <WorldCell> { endCell }; var curr = endCell; while (curr.Parent != null) { curr = curr.Parent; path.Add(curr); } path.Reverse(); return(path); }
private WorldCell[,] ConstructCells(List <Vector3> cellsPositions) { _width = (from p in cellsPositions select p.x) .Distinct() .Count(); _height = (from p in cellsPositions select p.z) .Distinct() .Count(); var cell = new WorldCell[_height, _width]; for (int y = 0; y < _height; ++y) { for (int x = 0; x < _height; ++x) { cell[y, x] = new WorldCell(cellsPositions[y * _width + x]); } } return(cell); }