// sound effects #endregion #region Constructors /// <summary> /// Constructor /// </summary> /// <param name="contentManager">the content manager</param> /// <param name="center">the center of the board</param> /// <param name="sideLength">the side length for the board</param> /// <param name="correctNumber">the correct number</param> public NumberBoard(ContentManager contentManager, Vector2 center, int sideLength, int correctNumber)//, SoundEffect sound) { // Increment 2: load content for the board and create draw rectangle LoadContent(contentManager); drawRectangle = new Rectangle((int)center.X - sideLength / 2, (int)center.Y - sideLength / 2, sideLength, sideLength); // Increment 2: calculate side length for number tiles // (3 * tilesLength) + ( 4 * borderSize) = sideLength // 3 = NumColumn // therefore (numColumn * tilesLength) + ((numColumn + 1) * borderSize) = sideLength //if we leave alone the tileSideLength then we'll found formula at below tileSideLength = ((sideLength) - ((NumColumns + 1) * BorderSize)) / NumColumns; // Increments 3 and 5: initialize array of number tiles for (int row = 0; row < NumRows; row++) { for (int column = 0; column < NumColumns; column++) { int number = NumColumns * row + column + 1; tiles[row, column] = new NumberTile(contentManager, CalculateTileCenter(row, column), tileSideLength, number, correctNumber); } } }
// sound effects #endregion #region Constructors /// <summary> /// Constructor /// </summary> /// <param name="contentManager">the content manager</param> /// <param name="center">the center of the board</param> /// <param name="sideLength">the side length for the board</param> /// <param name="correctNumber">the correct number</param> public NumberBoard(ContentManager contentManager, Vector2 center, int sideLength, int correctNumber) { // Increment 2: load content for the board and create draw rectangle LoadContent(contentManager); drawRectangle = new Rectangle( (int)center.X - sideLength / 2, (int)center.Y - sideLength / 2, sideLength, sideLength); // Increment 2: calculate side length for number tiles tileSideLength = (sideLength - (NumColumns + 1) * BorderSize) / NumColumns; // Increments 3 and 5: initialize array of number tiles for (int i = 0; i < NumRows; i++) { for (int j = 0; j < NumColumns; j++) { tiles[i, j] = new NumberTile(contentManager, CalculateTileCenter(i, j), tileSideLength, i * NumColumns + j + 1, correctNumber); } } }
// sound effects #endregion #region Constructors /// <summary> /// Constructor /// </summary> /// <param name="contentManager">the content manager</param> /// <param name="center">the center of the board</param> /// <param name="sideLength">the side length for the board</param> /// <param name="correctNumber">the correct number</param> public NumberBoard(ContentManager contentManager, Vector2 center, int sideLength, int correctNumber) { // Increment 2: load content for the board and create draw rectangle LoadContent(contentManager); drawRectangle = new Rectangle((int)center.X, (int)center.Y, sideLength, sideLength); // Increment 2: calculate side length for number tiles tileSideLength = (sideLength - 4 * BorderSize) / NumColumns; // Increments 3 and 5: initialize array of number tiles int number = 0; for (int n = 0; n < 3; n++) { for (int m = 0; m < 3; m++) { number++; tiles[n, m] = new NumberTile(contentManager, CalculateTileCenter(n, m), tileSideLength, number, correctNumber); } } }
// sound effects #endregion #region Constructors /// <summary> /// Constructor /// </summary> /// <param name="contentManager">the content manager</param> /// <param name="center">the center of the board</param> /// <param name="sideLength">the side length for the board</param> /// <param name="correctNumber">the correct number</param> public NumberBoard(ContentManager contentManager, Vector2 center, int sideLength, int correctNumber) { // Increment 2: load content for the board and create draw rectangle LoadContent(contentManager); drawRectangle = new Rectangle((int)(center.X - sideLength / 2), (int)(center.Y - sideLength / 2), sideLength, sideLength); // Increment 2: calculate side length for number tiles tileSideLength = drawRectangle.Width / NumColumns - BorderSize; // Increments 3 and 5: initialize array of number tiles int counter = 1; for (int i = tiles.GetLowerBound(0); i <= tiles.GetUpperBound(0); i++) { for (int j = tiles.GetLowerBound(1); j <= tiles.GetUpperBound(1); j++) { NumberTile newNumberTile = new NumberTile(contentManager, CalculateTileCenter(i, j), tileSideLength, counter, correctNumber); tiles[i, j] = newNumberTile; counter++; } } }