Compare commits

...

2 Commits

6 changed files with 9 additions and 10 deletions

View File

@ -33,7 +33,6 @@ 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);
@ -117,8 +116,6 @@ 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.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 + 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.DrawEllipse(pen, _startPosX, _startPosY + 40, 10, 10); g.FillEllipse(new SolidBrush(Color.Black), _startPosX, _startPosY + 40, 10, 10);
g.DrawEllipse(pen, _startPosX + 20, _startPosY + 40, 10, 10); g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 20, _startPosY + 40, 10, 10);
g.DrawEllipse(pen, _startPosX + 70, _startPosY + 40, 10, 10); g.FillEllipse(new SolidBrush(Color.Black), _startPosX + 70, _startPosY + 40, 10, 10);
g.DrawEllipse(pen, _startPosX + 90, _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); g.FillRectangle(new SolidBrush(Locomotive?.BodyColor ?? Color.Black), _startPosX + 100, _startPosY + 10, 10, 30);
} }

View File

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

View File

@ -18,5 +18,6 @@ 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.Gray); private readonly Brush roadColor = new SolidBrush(Color.Pink);
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.Gray); private readonly Brush roadColor = new SolidBrush(Color.Green);
protected override void DrawBarrierPart(Graphics g, int i, int j) protected override void DrawBarrierPart(Graphics g, int i, int j)
{ {