Ejemplo n.º 1
0
        void CreateCell(BoardLayout layout, int row, int col)
        {
            var newCellObject   = Instantiate(cellPrefab, this.Transform);
            var newCell         = newCellObject.GetComponent <BoardCell>();
            var newCellPosition = MatrixIndicesToBoardPosition(row, col);

            newCell.Position     = newCellPosition;
            newCell.Terrain      = layout.FindTerrainType(newCellPosition);
            this.cells[row, col] = newCell;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Loads in a given layout.
 /// </summary>
 /// <param name="layout">The layout to be loaded.</param>
 public void LoadLayout(BoardLayout layout)
 {
     this.cells = new BoardCell[layout.NumRows, layout.NumCols];
     for (int i = 0; i < NumRows; i++)
     {
         for (int j = 0; j < NumCols; j++)
         {
             CreateCell(layout, i, j);
         }
     }
     this.boardLoadedEvent?.Invoke(this);
     this.boardLoadedEvent = null;
 }