This commit is contained in:
Кашин Максим 2022-10-22 16:24:50 +04:00
parent f4524f8624
commit 67b9c8b39b
3 changed files with 10 additions and 10 deletions

View File

@ -17,14 +17,14 @@ public class DrawingGasolineTanker {
public DrawingGasolineTanker(int speed, float weight, Color bodyColor, int wheelsForm) public DrawingGasolineTanker(int speed, float weight, Color bodyColor, int wheelsForm)
{ {
GasolineTanker = new EntityGasolineTanker(speed, weight, bodyColor); GasolineTanker = new EntityGasolineTanker(speed, weight, bodyColor);
Wheels= GetFormOfBlock(wheelsForm); Wheels= GetFormOfWheels(wheelsForm);
Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2)); Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2));
} }
public IDrawningObjectWheels GetFormOfBlock(int FormOfBlock){ public IDrawningObjectWheels GetFormOfWheels(int FormOfWheel){
OrnamentForm temp = null; OrnamentForm temp = null;
for (OrnamentForm form:OrnamentForm.values()) { for (OrnamentForm form:OrnamentForm.values()) {
if(form.Value==FormOfBlock){ if(form.Value==FormOfWheel){
temp = form; temp = form;
break; break;
} }
@ -42,13 +42,13 @@ public class DrawingGasolineTanker {
return null; return null;
} }
protected DrawingGasolineTanker(int speed, float weight, Color bodyColor,int warshipWidth, int warshipHeight) protected DrawingGasolineTanker(int speed, float weight, Color bodyColor,int gasolineTankerWidth, int gasolineTankerHeight)
{ {
GasolineTanker = new EntityGasolineTanker(speed, weight, bodyColor); GasolineTanker = new EntityGasolineTanker(speed, weight, bodyColor);
Wheels= new DrawingWheels(_wheels); Wheels= new DrawingWheels(_wheels);
Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2)); Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2));
_gasolineTankerWidth=warshipWidth; _gasolineTankerWidth=gasolineTankerWidth;
_pictureHeight=warshipHeight; _pictureHeight=gasolineTankerHeight;
} }
public void SetPosition(int x, int y, int width, int height) public void SetPosition(int x, int y, int width, int height)

View File

@ -2,10 +2,10 @@ import java.awt.*;
public class DrawingImprovedGasolineTanker extends DrawingGasolineTanker { public class DrawingImprovedGasolineTanker extends DrawingGasolineTanker {
public DrawingImprovedGasolineTanker(int speed, float weight, Color bodyColor, Color dopColor, boolean bodyKit, boolean antena,int blockForm) { public DrawingImprovedGasolineTanker(int speed, float weight, Color bodyColor, Color dopColor, boolean bodyKit, boolean antena,int wheelForm) {
super(speed, weight, bodyColor, 160, 70); super(speed, weight, bodyColor, 160, 70);
GasolineTanker=new EntityImprovedGasolineTanker(speed,weight,bodyColor,dopColor,bodyKit,antena); GasolineTanker=new EntityImprovedGasolineTanker(speed,weight,bodyColor,dopColor,bodyKit,antena);
Wheels= GetFormOfBlock(blockForm); Wheels= GetFormOfWheels(wheelForm);
Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2)); Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2));
} }

View File

@ -32,8 +32,8 @@ public class DrawingMap extends JPanel {
Color color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); Color color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
if(color1==null) if(color1==null)
color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
DrawingGasolineTanker warship=new DrawingGasolineTanker(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3)); DrawingGasolineTanker gasolineTanker=new DrawingGasolineTanker(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3));
SetData(warship); SetData(gasolineTanker);
} }
public void CreateModifButtonAction(){ public void CreateModifButtonAction(){
Random rand=new Random(); Random rand=new Random();