diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/AbstractMap.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/AbstractMap.cs index 3cdcd3f..028cc6c 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/AbstractMap.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/AbstractMap.cs @@ -32,7 +32,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base public Bitmap MoveObject(Direction direction) { // TODO проверка, что объект может переместится в требуемом направлении - if (true) + if (true) { _drawningObject.MoveObject(direction); } diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs index 331603a..39c1573 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningBoat.cs @@ -174,7 +174,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base } public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() { - return (_startPosX, _startPosY, _startPosX + _boatWidth, _startPosY + _boatHeight); + return (_startPosX, _startPosX + _boatWidth, _startPosY, _startPosY + _boatHeight); } } } diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningObjectBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningObjectBoat.cs index 54f6375..ac982cb 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningObjectBoat.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/DrawningObjectBoat.cs @@ -14,22 +14,18 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base _boat = boat; } public float Step => _boat?.Boat?.Step ?? 0; - public void DrawningObject(Graphics g) { - // TODO + _boat?.DrawTransport(g); } - public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() { return _boat?.GetCurrentPosition() ?? default; } - public void MoveObject(Direction direction) { _boat.MoveTransport(direction); } - public void SetObject(int x, int y, int width, int height) { _boat.SetPosition(x, y, width, height); diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs index ef721fe..46ad07a 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormBoat.cs @@ -86,7 +86,6 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base.git { Random rnd = new(); _boat = new DrawningSportBoat(rnd.Next(5, 30), rnd.Next(30, 100), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2))); - SetData(); Draw(); } diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormMap.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormMap.cs index f87b40e..08c4558 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormMap.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/FormMap.cs @@ -37,9 +37,8 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - var car = new DrawningBoat(rnd.Next(100, 300), rnd.Next(1000, 2000), - Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); - SetData(car); + var boat = new DrawningBoat(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + SetData(boat); } /// /// Изменение размеров формы diff --git a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/SimpleMap.cs b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/SimpleMap.cs index 2b92899..73e16b4 100644 --- a/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/SimpleMap.cs +++ b/PIbd-22_Kalyshev_Y_V_MotorBoat_Base.git/SimpleMap.cs @@ -18,13 +18,11 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base private readonly Brush roadColor = new SolidBrush(Color.Gray); protected override void DrawBarrierPart(Graphics g, int i, int j) { - g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + - 1), j * (_size_y + 1)); + g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1)); } protected override void DrawRoadPart(Graphics g, int i, int j) { - g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + - 1), j * (_size_y + 1)); + g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1)); } protected override void GenerateMap() {