void Awake() { neighbors = new List <GridItem>(); GridItems = new GridItem[Rows * Cols]; var parent = transform.Find("Grids"); for (int row = 0; row < Rows; row++) { for (int col = 0; col < Cols; col++) { GridItem item = new GridItem(row, col, GridType.Normal); item.InitGameObject(parent, GridPrefab, itemSize); int index = GetTileIndex(row, col); GridItems[index] = item; } } SetStart(0, 0); SetEnd(9, 9); SetExpensive(1, 1); SetExpensive(1, 2); SetExpensive(2, 1); ResetGrids(); }
void Awake() { neighbors = new List <GridItem>(); GridItems = new GridItem[Rows * Cols]; var parent = transform.Find("Grids"); for (int row = 0; row < Rows; row++) { for (int col = 0; col < Cols; col++) { GridItem item = new GridItem(row, col, GridType.Normal); item.InitGameObject(parent, GridPrefab, itemSize); int index = GetTileIndex(row, col); GridItems[index] = item; } } ClearGrids(); }