diff --git a/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs b/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs
index b379b19..5b0c30f 100644
--- a/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs
+++ b/ProjectMotorBoat/ProjectMotorBoat/DrawingMotorBoat.cs
@@ -13,6 +13,11 @@ public class DrawingMotorBoat
///
public EntityMotorBoat? EntityMotorBoat { get; private set; }
+ ///
+ /// Класс-сущность
+ ///
+ public EntityPaddle? EntityPaddle { get; private set; }
+
///
/// Ширина окна
///
@@ -54,10 +59,12 @@ public class DrawingMotorBoat
///
///
///
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass, int paddle)
{
EntityMotorBoat = new EntityMotorBoat();
- EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, paddle, protectiveGlass);
+ EntityMotorBoat.Init(speed, weight, bodyColor, additionalColor, inboardEngine, protectiveGlass);
+ EntityPaddle = new EntityPaddle();
+ EntityPaddle.Init(paddle);
_pictureWidth = null;
_pictureHeight = null;
_startPosX = null;
@@ -245,17 +252,32 @@ public class DrawingMotorBoat
}
// Вёсла
- if (EntityMotorBoat.Paddle)
+ if (EntityPaddle.Paddle != 0)
{
- g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
- g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 30, 2, 17);
- g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
- g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 31, 1, 16);
+ if (EntityPaddle.Paddle >= 1)
+ {
+ g.DrawRectangle(pen, _startPosX.Value + 32, _startPosY.Value + 3, 2, 17);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 33, _startPosY.Value + 3, 1, 17);
- g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
- g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
- g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 42, 6, 8);
+ g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value, 6, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 30, _startPosY.Value, 6, 8);
+ }
+ if (EntityPaddle.Paddle >= 2)
+ {
+ g.DrawRectangle(pen, _startPosX.Value + 27, _startPosY.Value + 30, 2, 17);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 28, _startPosY.Value + 31, 1, 16);
+
+ g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 42, 6, 8);
+ }
+ if (EntityPaddle.Paddle == 3)
+ {
+ g.DrawRectangle(pen, _startPosX.Value + 36, _startPosY.Value + 30, 2, 17);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 37, _startPosY.Value + 31, 1, 16);
+
+ g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
+ g.FillEllipse(additionalBrush, _startPosX.Value + 34, _startPosY.Value + 42, 6, 8);
+ }
}
// Защитное стекло
diff --git a/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs b/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs
index 9d238ad..61179d9 100644
--- a/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs
+++ b/ProjectMotorBoat/ProjectMotorBoat/EntityMotorBoat.cs
@@ -30,10 +30,10 @@ public class EntityMotorBoat
///
public bool InboardEngine { get; private set; }
- ///
- /// Признак (опция) наличия вёсел
- ///
- public bool Paddle { get; private set; }
+ /////
+ ///// Признак (опция) наличия вёсел
+ /////
+ //public int Paddle { get; private set; }
///
/// Возможность глиссирования
@@ -55,14 +55,30 @@ public class EntityMotorBoat
///
///
///
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool paddle, bool protectiveGlass)
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool inboardEngine, bool protectiveGlass)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
InboardEngine = inboardEngine;
- Paddle = paddle;
ProtectiveGlass = protectiveGlass;
}
+}
+
+public class EntityPaddle
+{
+ ///
+ /// Признак (опция) наличия вёсел
+ ///
+ public int Paddle { get; private set; }
+
+ ///
+ /// Инициализация полей объекта-класса вёсел
+ ///
+ ///
+ public void Init(int paddle)
+ {
+ Paddle = paddle;
+ }
}
\ No newline at end of file
diff --git a/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs b/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs
index b12a68c..705ed40 100644
--- a/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs
+++ b/ProjectMotorBoat/ProjectMotorBoat/FormMotorBoat.cs
@@ -47,7 +47,7 @@ public partial class FormMotorBoat : Form
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
- Convert.ToBoolean(random.Next(0, 2)));
+ random.Next(0, 4));
_drawingMotorBoat.SetPictureSize(pictureBoxMotorBoat.Width, pictureBoxMotorBoat.Height);
_drawingMotorBoat.SetPosition(random.Next(10, 100), random.Next(10, 100));