готовая laba_2

This commit is contained in:
spacyboy 2023-11-22 03:50:40 +04:00
parent d00147fea5
commit 5ed8caf82c
5 changed files with 20 additions and 23 deletions

View File

@ -103,21 +103,19 @@ namespace RoadTrain.DrawingObjects
Brush bodyBrush = new SolidBrush(EntityRoadTrain.BodyColor); Brush bodyBrush = new SolidBrush(EntityRoadTrain.BodyColor);
Brush whiteBrush = new SolidBrush(Color.White); Brush whiteBrush = new SolidBrush(Color.White);
//машина //машина
g.DrawRectangle(pen, _startPosX - 20, _startPosY + 50 + 80, 160, 20); g.DrawRectangle(pen, _startPosX, _startPosY + 50, 160, 20);
g.FillRectangle(bodyBrush, _startPosX - 20, _startPosY + 50 + 80, 160, 20); g.FillRectangle(bodyBrush, _startPosX, _startPosY + 50, 160, 20);
g.DrawEllipse(pen, _startPosX + 5 - 20, _startPosY + 70 + 80, 30, 30); //колесо g.DrawEllipse(pen, _startPosX + 5, _startPosY + 70, 30, 30); //колесо
g.FillEllipse(bodyBrush, _startPosX + 5 - 20, _startPosY + 70 + 80, 30, 30); g.FillEllipse(bodyBrush, _startPosX + 5, _startPosY + 70 , 30, 30);
g.DrawEllipse(pen, _startPosX + 40 - 20, _startPosY + 70 + 80, 30, 30); //колесо g.DrawEllipse(pen, _startPosX + 40, _startPosY + 70, 30, 30); //колесо
g.FillEllipse(bodyBrush, _startPosX + 40 - 20, _startPosY + 70 + 80, 30, 30); g.FillEllipse(bodyBrush, _startPosX + 40, _startPosY + 70, 30, 30);
g.DrawEllipse(pen, _startPosX + 120 - 20, _startPosY + 70 + 80, 30, 30); //колесо g.DrawEllipse(pen, _startPosX + 120, _startPosY + 70, 30, 30); //колесо
g.FillEllipse(bodyBrush, _startPosX + 120 - 20, _startPosY + 70 + 80, 30, 30); g.FillEllipse(bodyBrush, _startPosX + 120, _startPosY + 70, 30, 30);
g.DrawRectangle(pen, _startPosX + 120 - 20, _startPosY + 10 + 80, 40, 40); //кабина g.DrawRectangle(pen, _startPosX + 120, _startPosY + 10, 40, 40); //кабина
g.FillRectangle(bodyBrush, _startPosX + 120 - 20, _startPosY + 10 + 80, 40, 40); g.FillRectangle(bodyBrush, _startPosX + 120, _startPosY + 10, 40, 40);
g.DrawRectangle(pen, _startPosX + 130 - 20, _startPosY + 20 + 80, 30, 20); //окно g.DrawRectangle(pen, _startPosX + 130, _startPosY + 20, 30, 20); //окно
g.FillRectangle(whiteBrush, _startPosX + 130 - 20, _startPosY + 20 + 80, 30, 20); g.FillRectangle(whiteBrush, _startPosX + 130, _startPosY + 20, 30, 20);
} }
} }

View File

@ -12,7 +12,7 @@ namespace RoadTrain.DrawingObjects
{ {
public DrawingRoadTrainWithTank(int speed, double weight, Color bodyColor, Color public DrawingRoadTrainWithTank(int speed, double weight, Color bodyColor, Color
additionalColor, bool pipes, bool section, int width, int height) additionalColor, bool pipes, bool section, int width, int height)
: base(speed, weight, bodyColor, width, height, 185, 180) : base(speed, weight, bodyColor, width, height, 200, 100)
{ {
if (EntityRoadTrain != null) if (EntityRoadTrain != null)
{ {
@ -34,15 +34,15 @@ namespace RoadTrain.DrawingObjects
Brush brGray = new SolidBrush(Color.Gray); Brush brGray = new SolidBrush(Color.Gray);
if (roadTrain.Brush) if (roadTrain.Brush)
{ {
g.DrawLine(pen, _startPosX + 160-20, _startPosY + 70 + 80, _startPosX + 180, _startPosY + 80 + 80); g.DrawLine(pen, _startPosX + 160, _startPosY + 70, _startPosX + 180, _startPosY + 80);
g.DrawRectangle(pen, _startPosX + 170-20, _startPosY + 80 + 80, 40, 10); //щетка g.DrawRectangle(pen, _startPosX + 170, _startPosY + 80, 40, 10); //щетка
g.FillRectangle(additionalBrush, _startPosX + 170-20, _startPosY + 80 + 80, 40, 10); g.FillRectangle(additionalBrush, _startPosX + 170, _startPosY + 80, 40, 10);
} }
//бак //бак
if (roadTrain.Tank) if (roadTrain.Tank)
{ {
g.DrawRectangle(pen, _startPosX + 10 - 20, _startPosY + 80, 90, 50); //бак с водой g.DrawRectangle(pen, _startPosX + 10, _startPosY, 90, 50); //бак с водой
g.FillRectangle(additionalBrush, _startPosX + 10-20, _startPosY + 80, 90, 50); g.FillRectangle(additionalBrush, _startPosX + 10, _startPosY, 90, 50);
} }
} }
} }

View File

@ -19,7 +19,6 @@ namespace RoadTrain.MovementStrategy
objParams.RightBorder + GetStep() >= FieldWidth && objParams.RightBorder + GetStep() >= FieldWidth &&
objParams.DownBorder <= FieldHeight && objParams.DownBorder <= FieldHeight &&
objParams.DownBorder + GetStep() >= FieldHeight; objParams.DownBorder + GetStep() >= FieldHeight;
} }
protected override void MoveToTarget() protected override void MoveToTarget()
{ {