Правка

This commit is contained in:
artur-kalimullin 2024-04-10 21:19:01 +04:00
parent d8ef359431
commit ae2b1c951d
7 changed files with 12 additions and 18 deletions

View File

@ -12,7 +12,7 @@ public class DrawningAirFighter {
private Integer _startPosY;
private final int _drawingAirFighterWidth = 76;
private final int _drawingAirFighterHeight = 80;
public DrawningAirFighterEngine drawningAirFighterEngine;
public DrawningAirFighterEngine _drawningAirFighterEngine;
public void Init(int speed, float weight, Color bodyColor, Color additionalColor, boolean pgo, boolean rockets) {
entityAirFighter = new EntityAirFighter();
@ -22,11 +22,11 @@ public class DrawningAirFighter {
_pictureWidth = null;
_pictureHeight = null;
drawningAirFighterEngine = new DrawningAirFighterEngine();
_drawningAirFighterEngine = new DrawningAirFighterEngine();
Random random = new Random();
int[] countengine = {2, 4, 6};
int paddlesCount = countengine[random.nextInt(countengine.length)];
drawningAirFighterEngine.setEnumNumber(paddlesCount);
int engineCount = countengine[random.nextInt(countengine.length)];
_drawningAirFighterEngine.setEnumNumber(engineCount);
}
public void setPosition(int x, int y) {
@ -218,7 +218,7 @@ public class DrawningAirFighter {
g.fillRect(_startPosX + 45, _startPosY + 3, 5, 4);
}
drawningAirFighterEngine.drawAirFighterEngine(g, entityAirFighter.getAdditionalColor(), _startPosX, _startPosY);
_drawningAirFighterEngine.drawAirFighterEngine(g, entityAirFighter.getAdditionalColor(), _startPosX, _startPosY);
}
}

View File

@ -1,11 +1,11 @@
import java.awt.*;
public class DrawningAirFighterEngine {
private EngineCount engineCount;
public void setEnumNumber(int wheelCount) {
private EngineCount _engineCount;
public void setEnumNumber(int engineCount) {
for (EngineCount value : EngineCount.values()) {
if (value.getEnumNumber() == wheelCount) {
engineCount = value;
if (value.getEnumNumber() == engineCount) {
_engineCount = value;
return;
}
}
@ -15,24 +15,18 @@ public class DrawningAirFighterEngine {
g2d.setColor(color);
g2d.setStroke(new BasicStroke(4));
if (engineCount.getEnumNumber() == 2){
if (_engineCount.getEnumNumber() <= 2){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 69, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 3, 10, 2 );
}
if (engineCount.getEnumNumber() == 4){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 69, 10, 2 );
if (_engineCount.getEnumNumber() <= 4){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 62, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 3, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 10, 10, 2 );
}
if (engineCount.getEnumNumber() == 6){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 69, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 62, 10, 2 );
if (_engineCount.getEnumNumber() <= 6){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 55, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 3, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 10, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 17, 10, 2 );
}
}