2022-10-08 23:13:09 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class ExtraStarWheelDraw implements IDrawningExtra{
|
|
|
|
private WheelsCount wheelsCount = WheelsCount.Two;
|
2022-10-22 01:15:02 +04:00
|
|
|
private ExtraWheelsDraw extraWheelsDraw;
|
2022-11-15 20:22:49 +04:00
|
|
|
private Color color;
|
2022-10-08 23:13:09 +04:00
|
|
|
public void setExtraNum(int num) {
|
|
|
|
switch (num) {
|
2022-11-19 19:32:56 +04:00
|
|
|
case 3: {
|
2022-10-08 23:13:09 +04:00
|
|
|
wheelsCount = WheelsCount.Three;
|
|
|
|
break;
|
|
|
|
}
|
2022-11-19 19:32:56 +04:00
|
|
|
case 4: {
|
2022-10-08 23:13:09 +04:00
|
|
|
wheelsCount = WheelsCount.Four;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-19 12:51:23 +04:00
|
|
|
public String TypeString() {
|
|
|
|
return "Star";
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getWheelsCount() {
|
|
|
|
if (wheelsCount == WheelsCount.Two) return 2;
|
|
|
|
if (wheelsCount == WheelsCount.Three) return 3;
|
|
|
|
else return 4;
|
|
|
|
}
|
|
|
|
|
2022-10-22 01:15:02 +04:00
|
|
|
public ExtraStarWheelDraw (int num, Color bodyColor) {
|
2022-10-08 23:13:09 +04:00
|
|
|
setExtraNum(num);
|
2022-10-22 01:15:02 +04:00
|
|
|
extraWheelsDraw = new ExtraWheelsDraw(num, bodyColor);
|
2022-10-08 23:13:09 +04:00
|
|
|
}
|
|
|
|
|
2022-11-15 20:22:49 +04:00
|
|
|
public void SetColor(Color color) {
|
|
|
|
this.color = color;
|
|
|
|
}
|
|
|
|
|
2022-10-08 23:13:09 +04:00
|
|
|
public void DrawExtra(int startPosX, int startPosY, Graphics2D g) {
|
2022-10-22 01:15:02 +04:00
|
|
|
extraWheelsDraw.DrawExtra(startPosX, startPosY, g);
|
2022-10-08 23:13:09 +04:00
|
|
|
DrawStarOnWheel(startPosX, startPosY + 30, g);
|
|
|
|
DrawStarOnWheel(startPosX + 90, startPosY + 30, g);
|
|
|
|
switch (wheelsCount) {
|
|
|
|
case Four: {
|
|
|
|
DrawStarOnWheel(startPosX + 70, startPosY + 30, g);
|
|
|
|
}
|
|
|
|
case Three: {
|
|
|
|
DrawStarOnWheel(startPosX + 20, startPosY + 30, g);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void DrawStarOnWheel(int startPosX, int startPosY, Graphics2D g) {
|
2022-11-15 20:22:49 +04:00
|
|
|
g.setColor(color);
|
2022-10-08 23:13:09 +04:00
|
|
|
g.drawLine(startPosX + 10, startPosY, startPosX + 15, startPosY + 17);
|
|
|
|
g.drawLine(startPosX + 10, startPosY, startPosX + 5, startPosY + 17);
|
|
|
|
g.drawLine(startPosX + 15, startPosY + 17, startPosX + 2, startPosY + 8);
|
|
|
|
g.drawLine(startPosX + 5, startPosY + 17, startPosX + 18, startPosY + 8);
|
|
|
|
g.drawLine(startPosX + 2, startPosY + 8, startPosX + 18, startPosY + 8);
|
|
|
|
}
|
|
|
|
}
|