2022-09-25 13:45:19 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
2022-10-08 22:13:56 +04:00
|
|
|
public class ExtraWheelsDraw implements IDrawningExtra{
|
2022-09-27 16:26:05 +04:00
|
|
|
private WheelsCount wheelsCount = WheelsCount.Two;
|
2022-10-08 22:13:56 +04:00
|
|
|
public void setExtraNum(int num) {
|
2022-09-27 16:26:05 +04:00
|
|
|
switch (num) {
|
2022-11-15 20:22:49 +04:00
|
|
|
case 3: {
|
2022-09-25 13:45:19 +04:00
|
|
|
wheelsCount = WheelsCount.Three;
|
|
|
|
break;
|
|
|
|
}
|
2022-11-15 20:22:49 +04:00
|
|
|
case 4: {
|
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-11-15 20:22:49 +04:00
|
|
|
public void SetColor(Color color) {
|
|
|
|
this.color = color;
|
|
|
|
}
|
2022-09-25 13:45:19 +04:00
|
|
|
|
2022-10-08 17:29:51 +04:00
|
|
|
public ExtraWheelsDraw(int num, Color color) {
|
2022-10-08 22:13:56 +04:00
|
|
|
setExtraNum(num);
|
2022-09-25 13:45:19 +04:00
|
|
|
this.color = color;
|
|
|
|
}
|
|
|
|
|
2022-11-19 12:51:23 +04:00
|
|
|
public String TypeString() {
|
|
|
|
return "Simple";
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getWheelsCount() {
|
|
|
|
if (wheelsCount == WheelsCount.Two) return 2;
|
|
|
|
if (wheelsCount == WheelsCount.Three) return 3;
|
|
|
|
else return 4;
|
|
|
|
}
|
|
|
|
|
2022-10-08 22:13:56 +04:00
|
|
|
public void DrawExtra(int startPosX, int startPosY, Graphics2D g) {
|
2022-10-08 23:13:09 +04:00
|
|
|
g.setColor(Color.BLACK);
|
|
|
|
g.drawOval(startPosX, startPosY + 30, 20, 20);
|
|
|
|
g.drawOval(startPosX + 90, startPosY + 30, 20, 20);
|
2022-11-15 20:22:49 +04:00
|
|
|
g.setColor(Color.BLACK);
|
2022-10-08 23:13:09 +04:00
|
|
|
g.fillOval(startPosX, startPosY + 30, 20, 20);
|
|
|
|
g.fillOval(startPosX + 90, startPosY + 30, 20, 20);
|
2022-09-25 13:45:19 +04:00
|
|
|
switch (wheelsCount) {
|
2022-09-27 16:26:05 +04:00
|
|
|
case Four: {
|
2022-10-08 23:13:09 +04:00
|
|
|
g.setColor(color);
|
2022-11-15 20:22:49 +04:00
|
|
|
g.drawOval(startPosX + 70, startPosY + 30, 20, 20);
|
|
|
|
g.setColor(Color.BLACK);
|
2022-10-08 23:13:09 +04:00
|
|
|
g.fillOval(startPosX + 70, startPosY + 30, 20, 20);
|
2022-09-25 13:45:19 +04:00
|
|
|
}
|
|
|
|
case Three: {
|
2022-10-08 23:13:09 +04:00
|
|
|
g.fillOval(startPosX + 20, startPosY + 30, 20, 20);
|
2022-11-15 20:22:49 +04:00
|
|
|
g.setColor(color);
|
2022-10-08 23:13:09 +04:00
|
|
|
g.drawOval(startPosX + 20, startPosY + 30, 20, 20);
|
2022-09-25 13:45:19 +04:00
|
|
|
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
|
|
|
}
|