Ejemplo n.º 1
0
		private void AffixBrick(Brick brick)
		{
			brick.TopLeftGridCoord = new Vector2D((int)brick.TopLeftGridCoord.X,
				(int)brick.TopLeftGridCoord.Y + 1);
			bricks[(int)brick.Position.X, (int)brick.Position.Y - 1] = brick;
			brick.UpdateDrawArea();
			AddZoomingBrick(brick);
		}
Ejemplo n.º 2
0
		private void CreateBricks()
		{
			int numberOfBricks = content.AreFiveBrickBlocksAllowed
				? GetNumberOfBricks() : NormalNumberOfBricks;
			var material = new Material(ShaderFlags.Position2DColoredTextured,
				content.Prefix + "Block" + Randomizer.Current.Get(1, 8));
			var newBrick = new Brick(material, Vector2D.Zero, displayMode);
			Bricks = new List<Brick> { newBrick };
			for (int i = 1; i < numberOfBricks; i++)
				AddBrick(Bricks[i - 1], material);
			ShiftToTopLeft();
		}
Ejemplo n.º 3
0
		private void AddBrick(Brick lastBrick, Material material)
		{
			Brick newBrick;
			bool anyBrickAtNewOffset;
			do
			{
				newBrick = new Brick(material, lastBrick.Offset + GetRandomOffset(), displayMode)
				{
					IsActive = false
				};
				anyBrickAtNewOffset = false;
				foreach (Brick brick in Bricks)
					if (brick.Offset == newBrick.Offset)
					{
						anyBrickAtNewOffset = true;
						break;
					}
			} while (anyBrickAtNewOffset);
			Bricks.Add(newBrick);
			newBrick.IsActive = true;
		}
Ejemplo n.º 4
0
 private bool IsOccupied(Brick brick)
 {
     return bricks[(int)brick.Position.X, (int)brick.Position.Y] != null;
 }
Ejemplo n.º 5
0
 //ncrunch: no coverage start
 private void AddPairOfFallingBricks(Brick brick)
 {
     AddTopFallingBrick(brick);
     AddBottomFallingBrick(brick);
 }
Ejemplo n.º 6
0
 private static bool IsOutsideTheGrid(Brick brick)
 {
     return brick.Position.X < 0 || brick.Position.X >= Width || brick.Position.Y < 1 ||
         brick.Position.Y >= Height;
 }
Ejemplo n.º 7
0
 private void CreateBricks()
 {
     int numberOfBricks = content.AreFiveBrickBlocksAllowed
         ? GetNumberOfBricks() : NormalNumberOfBricks;
     var image = content.Load<Image>("Block" + Randomizer.Current.Get(1, 8));
     var shader = ContentLoader.Load<Shader>(Shader.Position2DColorUV);
     var material = new Material(shader, image, image.PixelSize);
     var newBrick = new Brick(material, Vector2D.Zero, displayMode);
     Bricks = new List<Brick> { newBrick };
     for (int i = 1; i < numberOfBricks; i++)
         AddBrick(Bricks[i - 1], material);
     ShiftToTopLeft();
 }