2023-09-13 14:19:11 +04:00
|
|
|
package ProjectStormtrooper;
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
2023-10-10 12:26:20 +04:00
|
|
|
public class DrawingEnginesPyramid implements IDrawingEngines {
|
2023-09-13 14:19:11 +04:00
|
|
|
private EnumEnginesCount _enumEnginesCount;
|
|
|
|
|
2023-10-09 22:31:20 +04:00
|
|
|
@Override
|
2023-09-26 13:41:56 +04:00
|
|
|
public void SetEnumEnginesCount(int enginesCount) {
|
2023-09-13 14:19:11 +04:00
|
|
|
for (EnumEnginesCount val : EnumEnginesCount.values()) {
|
|
|
|
if (val.count == enginesCount) {
|
|
|
|
this._enumEnginesCount = val;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2023-09-26 13:41:56 +04:00
|
|
|
this._enumEnginesCount = EnumEnginesCount.Two;
|
2023-09-13 14:19:11 +04:00
|
|
|
}
|
|
|
|
|
2023-10-09 22:31:20 +04:00
|
|
|
@Override
|
|
|
|
public EnumEnginesCount GetEnumEnginesCount() {
|
|
|
|
return _enumEnginesCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void DrawEngine(Graphics2D g2d, Color color, int x, int y, int w, int h) {
|
2023-10-10 12:26:20 +04:00
|
|
|
Polygon enginePolygon = new Polygon();
|
|
|
|
enginePolygon.addPoint(x, y + h / 2);
|
|
|
|
enginePolygon.addPoint(x + w / 10, y);
|
|
|
|
enginePolygon.addPoint(x + w - w / 2, y + h / 2);
|
|
|
|
enginePolygon.addPoint(x + w, y);
|
|
|
|
enginePolygon.addPoint(x + w, y + h);
|
|
|
|
enginePolygon.addPoint(x + w - w / 2, y + h / 2);
|
|
|
|
enginePolygon.addPoint(x + w / 10, y + h);
|
2023-09-13 14:19:11 +04:00
|
|
|
g2d.setColor(Color.WHITE);
|
2023-10-10 12:26:20 +04:00
|
|
|
g2d.fillPolygon(enginePolygon);
|
2023-09-13 14:19:11 +04:00
|
|
|
g2d.setColor(Color.BLACK);
|
2023-10-10 12:26:20 +04:00
|
|
|
g2d.drawPolygon(enginePolygon);
|
2023-09-13 14:19:11 +04:00
|
|
|
}
|
|
|
|
}
|