фиксик

This commit is contained in:
asoc1al 2023-10-07 11:40:56 +04:00
parent e300a3d194
commit 35d382d586
2 changed files with 10 additions and 3 deletions

View File

@ -16,7 +16,7 @@ namespace DumpTruck
private int _pictureHeight; private int _pictureHeight;
protected readonly int _truckWidth = 100; protected readonly int _truckWidth = 100;
protected readonly int _truckHeight = 50; protected readonly int _truckHeight = 50;
public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, int width, int height) public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, int width, int height, bool threeWheels, bool dump)
{ {
if (width < _truckWidth || height < _truckHeight) if (width < _truckWidth || height < _truckHeight)
{ {
@ -25,7 +25,7 @@ namespace DumpTruck
_pictureWidth = width; _pictureWidth = width;
_pictureHeight = height; _pictureHeight = height;
EntityTruck = new EntityTruck(); EntityTruck = new EntityTruck();
EntityTruck.Init(speed, weight, bodyColor, additionalColor); EntityTruck.Init(speed, weight, bodyColor, additionalColor, threeWheels, dump);
return true; return true;
} }
public void SetPosition(int x, int y) public void SetPosition(int x, int y)
@ -113,6 +113,7 @@ namespace DumpTruck
g.DrawEllipse(pen, _startPosX + 22, _startPosY + 35, 20, 20); g.DrawEllipse(pen, _startPosX + 22, _startPosY + 35, 20, 20);
g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 20, 20); g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 20, 20);
//Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red); //Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red);
Brush brBodyAdditional = new SolidBrush(additionalColor); Brush brBodyAdditional = new SolidBrush(additionalColor);
g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30); g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30);

View File

@ -16,14 +16,20 @@ namespace DumpTruck
public Color BodyColor { get; private set; } public Color BodyColor { get; private set; }
public Color AdditionalColor { get; private set; } public Color AdditionalColor { get; private set; }
public bool ThreeWheels { get; private set; }
public bool Dump { get; private set; }
public float Step => Speed * 100 / Weight; public float Step => Speed * 100 / Weight;
public void Init(int speed, float weight, Color bodyColor, Color additionalColor) public void Init(int speed, float weight, Color bodyColor, Color additionalColor, bool threeWheels, bool dump)
{ {
Speed = speed; Speed = speed;
Weight = weight; Weight = weight;
BodyColor = bodyColor; BodyColor = bodyColor;
AdditionalColor = additionalColor; AdditionalColor = additionalColor;
ThreeWheels = threeWheels;
Dump = dump;
} }
} }
} }