/// <summary>
        /// Fills the field with bricks
        /// </summary>
        private static void FillBricks()
        {
            for (int x = 0; x < bricks.GetLength(0); x++)
            {
                for (int y = 0; y < bricks.GetLength(1); y++)
                {
                    PointF position = new PointF(gameField.Left
                        + GameSettings.BrickOffsetWidth
                        + (GameSettings.BrickSpacingWidth + GameSettings.BrickSizeWidth) * x,
                        GameSettings.BrickOffsetHeight
                        + (GameSettings.BrickSpacingHeight + GameSettings.BrickSizeHeight) * y);
                    int r = random.Next(10);
                    if (r < 7)
                        bricks[x, y] = new RegularBrick(position); // 7/10 chance
                    else if (r == 7)
                        bricks[x, y] = new BonusBrick(position); // 1/10 chance
                    else if (r == 8)
                        bricks[x, y] = new GhostBrick(position); // 1/10 chance
                    else
                        bricks[x, y] = new ChargedBrick(position); // 1/10 chance

                }
            }
        }
Exemple #2
0
 public void Brick_TestPosition()
 {
     PointF pos = new PointF(1.0f, 6.0f);
     Brick x = new RegularBrick(pos);
     Assert.AreEqual(x.GetPosition(), pos);
 }