private void Start() { gridPathCells = new PathCell[gridExtension.gridSize.x, gridExtension.gridSize.y]; for (int x = 0; x < gridExtension.gridSize.x; x++) { for (int y = 0; y < gridExtension.gridSize.y; y++) { gridPathCells[x, y] = gridExtension.GetCell(x, y).GetComponent <PathCell>(); gridPathCells[x, y].x = x; gridPathCells[x, y].y = y; } } }
public void Load() { for (int i = 0; i < gridExtension.gridSize.x; i++) { for (int j = 0; j < gridExtension.gridSize.y; j++) { string cellPrefKey = i + " " + j; PathCell.CellType type = PathCell.CellType.Empty; if (PlayerPrefs.HasKey(cellPrefKey)) { type = (PathCell.CellType)PlayerPrefs.GetInt(cellPrefKey); } GridCell gridCell = gridExtension.GetCell(i, j); if (gridCell) { PathCell pathCell = gridCell.GetComponent <PathCell>(); pathfindController.SetCellType(pathCell, type); } } } }