diff --git a/WarmlyShip/WarmlyShip/DrawningMotorShip.cs b/WarmlyShip/WarmlyShip/DrawningMotorShip.cs index 7ef8c2c..dd551ca 100644 --- a/WarmlyShip/WarmlyShip/DrawningMotorShip.cs +++ b/WarmlyShip/WarmlyShip/DrawningMotorShip.cs @@ -8,7 +8,7 @@ namespace WarmlyShip { internal class DrawningMotorShip : DrawningWarmlyShip { - public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool tubes, bool cistern) : base(speed, weight, bodyColor, 110, 60) + public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool tubes, bool cistern) : base(speed, weight, bodyColor, 150, 75) { warmlyShip = new EntityMotorShip(speed, weight, bodyColor, dopColor, tubes , cistern); } @@ -20,14 +20,24 @@ namespace WarmlyShip return; } + Pen pen = new(Color.Black, 2); + Brush dopBrush = new SolidBrush(motorShip.DopColor); if (motorShip.Tubes) { - + g.FillRectangle(dopBrush, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2); + g.DrawRectangle(pen, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2); + g.FillRectangle(dopBrush, _startPosX + _warmlyShipWidth * 3 / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2); + g.DrawRectangle(pen, _startPosX + _warmlyShipWidth * 3 / 5, _startPosY, _warmlyShipWidth / 5, _warmlyShipHeight / 2); } + _startPosY += 25; + base.DrawTransport(g); + _startPosY -= 25; + if (motorShip.Cistern) { - + g.FillEllipse(dopBrush, _startPosX, _startPosY + 25, 25, 20); + g.DrawEllipse(pen, _startPosX, _startPosY + 25, 25, 20); } } } diff --git a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs index b3e03f1..74f0c7b 100644 --- a/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/DrawningWarmlyShip.cs @@ -13,8 +13,8 @@ namespace WarmlyShip protected float _startPosY; //Координаты отрисовки по оси y private int? _pictureWidth = null; //Ширина окна private int? _pictureHeight = null; //Высота окна - private readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля - private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля + protected readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля + protected readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля //Конструктор класса public DrawningWarmlyShip(int speed, float weight, Color bodyColor) @@ -73,8 +73,8 @@ namespace WarmlyShip { new Point((int)(_startPosX), (int)(_startPosY + 20)), new Point((int)(_startPosX + _warmlyShipWidth), (int)(_startPosY + 20)), - new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + _warmlyShipHeight)), - new Point((int)(_startPosX + 25), (int)(_startPosY + _warmlyShipHeight)) + new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + 50)), + new Point((int)(_startPosX + 25), (int)(_startPosY +50)) }); g.FillRectangle(brush, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth * 3 / 5, 20); g.FillEllipse(new SolidBrush(Color.Aquamarine), _startPosX + _warmlyShipWidth / 5, _startPosY + 25, 20, 20); @@ -84,8 +84,8 @@ namespace WarmlyShip { new Point((int)(_startPosX), (int)(_startPosY + 20)), new Point((int)(_startPosX + _warmlyShipWidth), (int)(_startPosY + 20)), - new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + _warmlyShipHeight)), - new Point((int)(_startPosX + 25), (int)(_startPosY + _warmlyShipHeight)) + new Point((int)(_startPosX + _warmlyShipWidth - 25), (int)(_startPosY + 50)), + new Point((int)(_startPosX + 25), (int)(_startPosY + 50)) }); g.DrawRectangle(pen, _startPosX + _warmlyShipWidth / 5, _startPosY, _warmlyShipWidth * 3 / 5, 20); g.DrawEllipse(new(Color.Blue, 2), _startPosX + _warmlyShipWidth / 5, _startPosY + 25, 20, 20); diff --git a/WarmlyShip/WarmlyShip/FormClass.cs b/WarmlyShip/WarmlyShip/FormClass.cs index c28b163..9348d08 100644 --- a/WarmlyShip/WarmlyShip/FormClass.cs +++ b/WarmlyShip/WarmlyShip/FormClass.cs @@ -20,7 +20,7 @@ namespace WarmlyShip private void SetData() { Random random = new Random(); - _warmlyShip.SetPosition(random.Next(pictureBox.Width - 150, pictureBox.Width - 125), random.Next(pictureBox.Height - 150, pictureBox.Height - 50), pictureBox.Width, pictureBox.Height); + _warmlyShip.SetPosition(random.Next(0, 100), random.Next(0, 100), pictureBox.Width, pictureBox.Height); toolStripStatusSpeed.Text = $": {_warmlyShip.warmlyShip?.Speed}"; toolStripStatusWeight.Text = $": {_warmlyShip.warmlyShip?.Weight}"; toolStripStatusLabelBodyColor.Text = $": {_warmlyShip.warmlyShip?.BodyColor}"; @@ -67,7 +67,7 @@ namespace WarmlyShip _warmlyShip = new DrawningMotorShip(random.Next(100, 300), random.Next(1000, 3000), 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, 1)), Convert.ToBoolean(random.Next(0, 1))); + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); SetData(); Draw(); }