49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
|
import java.awt.*;
|
||
|
|
||
|
public class ExtraWheelsDraw {
|
||
|
private WheelsCount wheelsCount;
|
||
|
private int wheelsNum;
|
||
|
public void setWheelsNum(int num) {
|
||
|
wheelsNum = num;
|
||
|
switch (wheelsNum) {
|
||
|
case 0: {
|
||
|
wheelsCount = WheelsCount.Two;
|
||
|
break;
|
||
|
}
|
||
|
case 1: {
|
||
|
wheelsCount = WheelsCount.Three;
|
||
|
break;
|
||
|
}
|
||
|
case 2: {
|
||
|
wheelsCount = WheelsCount.Four;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
private final Color color;
|
||
|
|
||
|
public ExtraWheelsDraw(int num, Color color) {
|
||
|
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) {
|
||
|
case Two: {
|
||
|
break;
|
||
|
}
|
||
|
case Three: {
|
||
|
g.drawOval(startPosX + 20, startPosY + 40, 10, 10);
|
||
|
break;
|
||
|
}
|
||
|
case Four: {
|
||
|
g.drawOval(startPosX + 20, startPosY + 40, 10, 10);
|
||
|
g.drawOval(startPosX + 70, startPosY + 40, 10, 10);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|