52 lines
1.5 KiB
Java
52 lines
1.5 KiB
Java
import java.awt.*;
|
|
|
|
public class ExtraWheelsDraw implements IDrawningExtra{
|
|
private WheelsCount wheelsCount = WheelsCount.Two;
|
|
public void setExtraNum(int num) {
|
|
switch (num) {
|
|
case 0: {
|
|
wheelsCount = WheelsCount.Three;
|
|
break;
|
|
}
|
|
case 1: {
|
|
wheelsCount = WheelsCount.Four;
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
private Color color;
|
|
|
|
public ExtraWheelsDraw(int num, Color color) {
|
|
setExtraNum(num);
|
|
this.color = color;
|
|
}
|
|
|
|
public void DrawExtra(int startPosX, int startPosY, Graphics2D g) {
|
|
g.setColor(Color.BLACK);
|
|
g.drawOval(startPosX, startPosY + 30, 20, 20);
|
|
g.drawOval(startPosX + 90, startPosY + 30, 20, 20);
|
|
g.setColor(color);
|
|
g.fillOval(startPosX, startPosY + 30, 20, 20);
|
|
g.fillOval(startPosX + 90, startPosY + 30, 20, 20);
|
|
switch (wheelsCount) {
|
|
case Four: {
|
|
g.setColor(Color.BLACK);
|
|
g.drawOval(startPosX + 70, startPosY + 30, 20, 20);
|
|
g.setColor(color);
|
|
g.fillOval(startPosX + 70, startPosY + 30, 20, 20);
|
|
}
|
|
case Three: {
|
|
g.fillOval(startPosX + 20, startPosY + 30, 20, 20);
|
|
g.setColor(Color.BLACK);
|
|
g.drawOval(startPosX + 20, startPosY + 30, 20, 20);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|