готовая лаба5

This commit is contained in:
spacyboy 2023-12-12 16:44:42 +04:00
parent cb5e989a82
commit 428d7a0678

View File

@ -119,50 +119,8 @@ namespace RoadTrain.DrawingObjects
break;
}
}
<<<<<<< HEAD
public bool CanMove(DirectionType direction)
{
if (EntityRoadTrain == null)
{
return false;
}
return direction switch
{
DirectionType.Left => _startPosX - EntityRoadTrain.Step > 0,
DirectionType.Up => _startPosY - EntityRoadTrain.Step > 0,
DirectionType.Right => _startPosX + EntityRoadTrain.Step + _roadTrainWidth < _pictureWidth,
DirectionType.Down => _startPosY + EntityRoadTrain.Step + _roadTrainHeight < _pictureHeight,
_ => false,
};
}
public virtual void DrawTransport(Graphics g)
{
if (EntityRoadTrain == null)
{
return;
}
Pen pen = new(Color.Black, 2);
Pen anchor = new(Color.Black, 4);
Brush bodyBrush = new SolidBrush(EntityRoadTrain.BodyColor);
Brush whiteBrush = new SolidBrush(Color.White);
//машина
g.DrawRectangle(pen, _startPosX, _startPosY + 50, 160, 20);
g.FillRectangle(bodyBrush, _startPosX, _startPosY + 50, 160, 20);
g.DrawEllipse(pen, _startPosX + 5, _startPosY + 70, 30, 30); //колесо
g.FillEllipse(bodyBrush, _startPosX + 5, _startPosY + 70, 30, 30);
g.DrawEllipse(pen, _startPosX + 40, _startPosY + 70, 30, 30); //колесо
g.FillEllipse(bodyBrush, _startPosX + 40, _startPosY + 70, 30, 30);
g.DrawEllipse(pen, _startPosX + 120, _startPosY + 70, 30, 30); //колесо
g.FillEllipse(bodyBrush, _startPosX + 120, _startPosY + 70, 30, 30);
g.DrawRectangle(pen, _startPosX + 120, _startPosY + 10, 40, 40); //кабина
g.FillRectangle(bodyBrush, _startPosX + 120, _startPosY + 10, 40, 40);
g.DrawRectangle(pen, _startPosX + 130, _startPosY + 20, 30, 20); //окно
g.FillRectangle(whiteBrush, _startPosX + 130, _startPosY + 20, 30, 20);
=======
public IMoveableObject GetMoveableObject => new DrawingObjectTrain(this);
public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
>>>>>>> a4a5763 (готовая лаба 5)
{
_pictureWidth = pictureBoxWidth;