PIbd-22_Bondarenko_M.S._War.../DrawGuns.java
Макс Бондаренко 1703457b15 готово
2022-11-29 22:18:43 +04:00

33 lines
1.2 KiB
Java

import java.awt.*;
public class DrawGuns implements IDrawningDeck {
private Deck gunsCount;
@Override
public void SetDeckCount(int count) {
gunsCount = Deck.GetDeck(count);
}
@Override
public void DrawningDeck(float _startPosX, float _startPosY, int _warmlyShipWidth, Graphics2D g2d, Color bodyColor) {
int count = 1;
switch (gunsCount)
{
case One:
break;
case Two:
count = 2;
break;
case Three:
count = 3;
break;
}
g2d.setColor(Color.DARK_GRAY);
for (int i = 0; i < count; ++i)
{
g2d.fillPolygon(new Polygon(new int[]{(int)(_startPosX + _warmlyShipWidth / 5 * (i + 1)) + 10, (int)(_startPosX + _warmlyShipWidth / 5 * (i + 1)) + 25, (int)(_startPosX + _warmlyShipWidth / 5 * (i + 1)) + 40, (int)(_startPosX + _warmlyShipWidth / 5 * (i + 1)) + 25}, new int[]{(int)_startPosY - 20, (int)_startPosY - 10, (int)_startPosY - 30, (int)_startPosY - 40}, 4));
g2d.fillOval((int)(_startPosX + _warmlyShipWidth / 5 * (i + 1)), (int)_startPosY - 20, 25, 20);
}
}
}