private bool CheckForHitOnSameRowNeighbour(Rectangle ballRectangle, IEnumerable<Brick> allBricks, Brick brick) { Brick neighbour = allBricks .FirstOrDefault(b => b.RowNumber == brick.RowNumber && b.ColumnNumber == (brick.ColumnNumber + 1)); return neighbour != null && neighbour.Boundary.Intersects(ballRectangle); }
public void AddBrick(BrickData brickData, int xPos, int yPos, float scale) { var brick = new Brick(xPos, yPos, scale) {ColumnNumber = brickData.ColumnNumber, RowNumber = brickData.RowNumber}; Bricks.Add(brick); }