2022-09-25 13:45:19 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class ExtraWheelsDraw {
|
2022-09-27 16:26:05 +04:00
|
|
|
private WheelsCount wheelsCount = WheelsCount.Two;
|
2022-09-25 13:45:19 +04:00
|
|
|
public void setWheelsNum(int num) {
|
2022-09-27 16:26:05 +04:00
|
|
|
switch (num) {
|
2022-09-25 13:45:19 +04:00
|
|
|
case 0: {
|
|
|
|
wheelsCount = WheelsCount.Three;
|
|
|
|
break;
|
|
|
|
}
|
2022-09-27 16:26:05 +04:00
|
|
|
case 1: {
|
2022-09-25 13:45:19 +04:00
|
|
|
wheelsCount = WheelsCount.Four;
|
|
|
|
break;
|
|
|
|
}
|
2022-09-27 16:26:05 +04:00
|
|
|
default:
|
|
|
|
break;
|
2022-09-25 13:45:19 +04:00
|
|
|
}
|
|
|
|
}
|
2022-09-27 16:26:05 +04:00
|
|
|
private Color color;
|
2022-09-25 13:45:19 +04:00
|
|
|
|
2022-09-27 16:26:05 +04:00
|
|
|
public void Init(int num, Color color) {
|
2022-09-25 13:45:19 +04:00
|
|
|
setWheelsNum(num);
|
|
|
|
this.color = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DrawWheels(int startPosX, int startPosY, Graphics2D g) {
|
|
|
|
g.setColor(color);
|
|
|
|
g.drawOval(startPosX, startPosY + 40, 10, 10);
|
|
|
|
g.drawOval(startPosX + 90, startPosY + 40, 10, 10);
|
|
|
|
switch (wheelsCount) {
|
2022-09-27 16:26:05 +04:00
|
|
|
case Four: {
|
|
|
|
g.drawOval(startPosX + 70, startPosY + 40, 10, 10);
|
2022-09-25 13:45:19 +04:00
|
|
|
}
|
|
|
|
case Three: {
|
|
|
|
g.drawOval(startPosX + 20, startPosY + 40, 10, 10);
|
|
|
|
break;
|
|
|
|
}
|
2022-09-27 16:26:05 +04:00
|
|
|
default:
|
|
|
|
break;
|
2022-09-25 13:45:19 +04:00
|
|
|
}
|
|
|
|
}
|
2022-09-27 16:26:05 +04:00
|
|
|
|
2022-09-25 13:45:19 +04:00
|
|
|
}
|