private void GeneratePath(List <Vector3> path, int beginIndex, int endIndex) { var pathSearch = new PathSearch(mapDic, rows, cols); var indexList = pathSearch.GeneratePath(beginIndex, endIndex); foreach (var index in indexList) { path.Add(GetPosFromIndex(index)); } }