Готовая лаб 2

This commit is contained in:
Данила Мочалов 2022-09-27 15:56:36 +04:00
parent b740601834
commit 45bf8f801a
4 changed files with 7 additions and 10 deletions

View File

@ -33,7 +33,6 @@ namespace Locomotive
public Bitmap MoveObject(Direction direction)
{
// added logic must be checked!
bool isFree = true;
int startPosX = (int)(_drawningObject.GetCurrentPosition().Left / _size_x);
@ -117,8 +116,6 @@ namespace Locomotive
int y = _random.Next(0, 10);
_drawningObject.SetObject(x, y, _width, _height);
// added logic must be checked!
for (int i = 0; i < _map.GetLength(0); ++i)
{
for (int j = 0; j < _map.GetLength(1); ++j)

View File

@ -107,7 +107,7 @@ namespace Locomotive
}
Pen pen = new(Color.Black);
//тело
g.DrawRectangle(pen, _startPosX , _startPosY, 110 - 10, 50 - 10);
g.FillRectangle(new SolidBrush(Color.MediumBlue), _startPosX , _startPosY, 110 - 10, 50 - 10);
//окна
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 10, _startPosY + 10, 10, 10);
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 30, _startPosY + 10, 10, 10);
@ -115,10 +115,10 @@ namespace Locomotive
//дверь
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 10, 10, 20);
//колеса
g.DrawEllipse(pen, _startPosX, _startPosY + 40, 10, 10);
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 40, 10, 10);
g.DrawEllipse(pen, _startPosX + 70, _startPosY + 40, 10, 10);
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 40, 10, 10);
g.FillEllipse(new SolidBrush(Color.Black), _startPosX, _startPosY + 40, 10, 10);
g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 20, _startPosY + 40, 10, 10);
g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 70, _startPosY + 40, 10, 10);
g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 90, _startPosY + 40, 10, 10);
//черный прямоугольник
g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 100, _startPosY + 10, 10, 30);
}

View File

@ -11,7 +11,7 @@ namespace Locomotive
/// Цвет участка закрытого
private readonly Brush barrierColor = new SolidBrush(Color.Black);
/// Цвет участка открытого
private readonly Brush roadColor = new SolidBrush(Color.Gray);
private readonly Brush roadColor = new SolidBrush(Color.Pink);
protected override void DrawBarrierPart(Graphics g, int i, int j)
{

View File

@ -11,7 +11,7 @@ namespace Locomotive
/// Цвет участка закрытого
private readonly Brush barrierColor = new SolidBrush(Color.Black);
/// Цвет участка открытого
private readonly Brush roadColor = new SolidBrush(Color.Gray);
private readonly Brush roadColor = new SolidBrush(Color.Green);
protected override void DrawBarrierPart(Graphics g, int i, int j)
{