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); }
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(); }
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; }
private bool IsOccupied(Brick brick) { return bricks[(int)brick.Position.X, (int)brick.Position.Y] != null; }
//ncrunch: no coverage start private void AddPairOfFallingBricks(Brick brick) { AddTopFallingBrick(brick); AddBottomFallingBrick(brick); }
private static bool IsOutsideTheGrid(Brick brick) { return brick.Position.X < 0 || brick.Position.X >= Width || brick.Position.Y < 1 || brick.Position.Y >= Height; }
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(); }