Правка

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 Integer _startPosY;
private final int _drawingAirFighterWidth = 76; private final int _drawingAirFighterWidth = 76;
private final int _drawingAirFighterHeight = 80; 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) { public void Init(int speed, float weight, Color bodyColor, Color additionalColor, boolean pgo, boolean rockets) {
entityAirFighter = new EntityAirFighter(); entityAirFighter = new EntityAirFighter();
@ -22,11 +22,11 @@ public class DrawningAirFighter {
_pictureWidth = null; _pictureWidth = null;
_pictureHeight = null; _pictureHeight = null;
drawningAirFighterEngine = new DrawningAirFighterEngine(); _drawningAirFighterEngine = new DrawningAirFighterEngine();
Random random = new Random(); Random random = new Random();
int[] countengine = {2, 4, 6}; int[] countengine = {2, 4, 6};
int paddlesCount = countengine[random.nextInt(countengine.length)]; int engineCount = countengine[random.nextInt(countengine.length)];
drawningAirFighterEngine.setEnumNumber(paddlesCount); _drawningAirFighterEngine.setEnumNumber(engineCount);
} }
public void setPosition(int x, int y) { public void setPosition(int x, int y) {
@ -218,7 +218,7 @@ public class DrawningAirFighter {
g.fillRect(_startPosX + 45, _startPosY + 3, 5, 4); 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.*; import java.awt.*;
public class DrawningAirFighterEngine { public class DrawningAirFighterEngine {
private EngineCount engineCount; private EngineCount _engineCount;
public void setEnumNumber(int wheelCount) { public void setEnumNumber(int engineCount) {
for (EngineCount value : EngineCount.values()) { for (EngineCount value : EngineCount.values()) {
if (value.getEnumNumber() == wheelCount) { if (value.getEnumNumber() == engineCount) {
engineCount = value; _engineCount = value;
return; return;
} }
} }
@ -15,24 +15,18 @@ public class DrawningAirFighterEngine {
g2d.setColor(color); g2d.setColor(color);
g2d.setStroke(new BasicStroke(4)); 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 + 69, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 3, 10, 2 ); g2d.drawRect((int)startPosX + 30, (int) startPosY + 3, 10, 2 );
} }
if (engineCount.getEnumNumber() == 4){ if (_engineCount.getEnumNumber() <= 4){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 69, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 62, 10, 2 ); 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 ); g2d.drawRect((int)startPosX + 30, (int) startPosY + 10, 10, 2 );
} }
if (engineCount.getEnumNumber() == 6){ if (_engineCount.getEnumNumber() <= 6){
g2d.drawRect((int)startPosX + 30, (int) startPosY + 69, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 62, 10, 2 );
g2d.drawRect((int)startPosX + 30, (int) startPosY + 55, 10, 2 ); 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 ); g2d.drawRect((int)startPosX + 30, (int) startPosY + 17, 10, 2 );
} }
} }