import java.awt.*; public class DrawningBlocks implements IDrawningBlocks { private DirectionBlocksOnDeck blocksCount = DirectionBlocksOnDeck.Two; private Color color; public DrawningBlocks(int count, Color color){ SetBlocks(count); this.color = color; } @Override public void DrawBlocks(Graphics g, int x, int y, Color bodyColor) { g.setColor(color != null ? color : Color.BLACK); switch (blocksCount) { case Four -> { g.fillRect(x + 58, y, 8, 5); g.fillRect(x + 70, y, 8, 5); g.fillRect(x + 70, y + 40, 8, 5); g.fillRect(x + 58, y + 40, 8, 5); } case Six -> { g.fillRect(x + 46, y, 8, 5); g.fillRect(x + 58, y , 8, 5); g.fillRect(x + 70, y, 8, 5); g.fillRect(x + 46, y + 45, 8, 5); g.fillRect(x + 58, y + 45, 8, 5); g.fillRect(x + 70, y + 45, 8, 5); } } } @Override public void SetBlocks(int count) { switch(count) { case 4: blocksCount = DirectionBlocksOnDeck.Four; break; case 6: blocksCount = DirectionBlocksOnDeck.Six; break; default: break; } } }