PIbd-12_Karamushko_M.K._Air.../DrawingEngines.java

34 lines
1010 B
Java
Raw Normal View History

2022-10-28 21:18:49 +04:00
import java.awt.*;
public class DrawingEngines {
private EnginesCount enginesCount;
private Color color;
public void Init(int count, Color bodyColor) {
2022-11-02 09:51:14 +04:00
setCount(count);
color = bodyColor;
}
public void setCount(int count) {
2022-10-28 21:18:49 +04:00
if(count <= 2) enginesCount = EnginesCount.Two;
else if(count >= 6) enginesCount = EnginesCount.Six;
else enginesCount = EnginesCount.Four;
}
public void draw(Graphics2D g, int startPosX, int startPosY) {
g.setPaint(color);
g.fillOval(startPosX + 90, startPosY + 10, 30, 15);
g.fillOval(startPosX + 90, startPosY + 141, 30, 15);
if(enginesCount == EnginesCount.Two) return;
g.fillOval(startPosX + 90, startPosY + 30, 30, 15);
g.fillOval(startPosX + 90, startPosY + 121, 30, 15);
if(enginesCount == EnginesCount.Four) return;
g.fillOval(startPosX + 90, startPosY + 50, 30, 15);
g.fillOval(startPosX + 90, startPosY + 101, 30, 15);
}
}