Compare commits

..

No commits in common. "c3c543ae46d6d2d6356d7a77a09b8efaf672da02" and "b740601834486a7f0ee898bc10901395a6d47f70" have entirely different histories.

6 changed files with 10 additions and 9 deletions

View File

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

View File

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

View File

@ -36,6 +36,5 @@ namespace Locomotive
{ {
_locomotive?.SetPosition(x, y, width, height); _locomotive?.SetPosition(x, y, width, height);
} }
} }
} }

View File

@ -18,6 +18,5 @@ namespace Locomotive
void DrawningObject(Graphics g); void DrawningObject(Graphics g);
/// Получение текущей позиции объекта /// Получение текущей позиции объекта
(float Left, float Right, float Top, float Bottom) GetCurrentPosition(); (float Left, float Right, float Top, float Bottom) GetCurrentPosition();
} }
} }

View File

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