lab2 #2
@ -16,7 +16,7 @@ namespace DumpTruck
|
||||
private int _pictureHeight;
|
||||
protected readonly int _truckWidth = 100;
|
||||
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)
|
||||
{
|
||||
@ -25,7 +25,7 @@ namespace DumpTruck
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityTruck = new EntityTruck();
|
||||
EntityTruck.Init(speed, weight, bodyColor, additionalColor);
|
||||
EntityTruck.Init(speed, weight, bodyColor, additionalColor, threeWheels, dump);
|
||||
return true;
|
||||
}
|
||||
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 + 80, _startPosY + 35, 20, 20);
|
||||
|
||||
|
||||
//Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red);
|
||||
Brush brBodyAdditional = new SolidBrush(additionalColor);
|
||||
g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30);
|
||||
|
@ -16,14 +16,20 @@ namespace DumpTruck
|
||||
public Color BodyColor { 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 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;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
ThreeWheels = threeWheels;
|
||||
Dump = dump;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user