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)
{
GasolineTanker = new EntityGasolineTanker(speed, weight, bodyColor);
Wheels= GetFormOfBlock(wheelsForm);
Wheels= GetFormOfWheels(wheelsForm);
Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2));
}
public IDrawningObjectWheels GetFormOfBlock(int FormOfBlock){
public IDrawningObjectWheels GetFormOfWheels(int FormOfWheel){
OrnamentForm temp = null;
for (OrnamentForm form:OrnamentForm.values()) {
if(form.Value==FormOfBlock){
if(form.Value==FormOfWheel){
temp = form;
break;
}
@ -42,13 +42,13 @@ public class DrawingGasolineTanker {
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);
Wheels= new DrawingWheels(_wheels);
Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2));
_gasolineTankerWidth=warshipWidth;
_pictureHeight=warshipHeight;
_gasolineTankerWidth=gasolineTankerWidth;
_pictureHeight=gasolineTankerHeight;
}
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 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);
GasolineTanker=new EntityImprovedGasolineTanker(speed,weight,bodyColor,dopColor,bodyKit,antena);
Wheels= GetFormOfBlock(blockForm);
Wheels= GetFormOfWheels(wheelForm);
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));
if(color1==null)
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));
SetData(warship);
DrawingGasolineTanker gasolineTanker=new DrawingGasolineTanker(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3));
SetData(gasolineTanker);
}
public void CreateModifButtonAction(){
Random rand=new Random();