package ProjectStormtrooper; import java.awt.*; public class DrawingEnginesPyramid implements IDrawingEngines { private EnumEnginesCount _enumEnginesCount; @Override public void SetEnumEnginesCount(int enginesCount) { for (EnumEnginesCount val : EnumEnginesCount.values()) { if (val.count == enginesCount) { this._enumEnginesCount = val; return; } } this._enumEnginesCount = EnumEnginesCount.Two; } @Override public EnumEnginesCount GetEnumEnginesCount() { return _enumEnginesCount; } @Override public void DrawEngine(Graphics2D g2d, Color color, int x, int y, int w, int h) { 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); g2d.setColor(Color.WHITE); g2d.fillPolygon(enginePolygon); g2d.setColor(Color.BLACK); g2d.drawPolygon(enginePolygon); } }