From 33d1b6d8469fc0e7cd73735bd73747ebe743dc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=20=D0=91=D0=BE=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 21 Sep 2022 10:49:05 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs | 14 ++++++++---- WarmlyShip/WarmlyShip/DrawningMotorShip.cs | 25 ++++++++++++++++++++++ WarmlyShip/WarmlyShip/EntityMotorShip.cs | 25 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 WarmlyShip/WarmlyShip/DrawningMotorShip.cs create mode 100644 WarmlyShip/WarmlyShip/EntityMotorShip.cs diff --git a/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs b/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs index ac2bdeb..cb9311e 100644 --- a/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs @@ -8,9 +8,9 @@ namespace WarmlyShip { internal class DrawingWarmlyShip { - public EntityWarmlyShip warmlyShip { private set; get; } //Класс-сущность - public float _startPosX; //Координаты отрисовки по оси x - public float _startPosY; //Координаты отрисовки по оси y + public EntityWarmlyShip warmlyShip { protected set; get; } //Класс-сущность + protected float _startPosX; //Координаты отрисовки по оси x + protected float _startPosY; //Координаты отрисовки по оси y private int? _pictureWidth = null; //Ширина окна private int? _pictureHeight = null; //Высота окна private readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля @@ -21,6 +21,12 @@ namespace WarmlyShip warmlyShip = new EntityWarmlyShip(speed, weight, bodyColor); } + protected DrawingWarmlyShip(int speed, float weight, Color bodyColor, int warmlyWidth, int warmlyHeight) : this(speed, weight, bodyColor) + { + _warmlyShipWidth = warmlyWidth; + _warmlyShipHeight = warmlyHeight; + } + public void SetPosition(int x, int y, int width, int height) { if (width < _warmlyShipWidth || height < _warmlyShipHeight) return; @@ -51,7 +57,7 @@ namespace WarmlyShip } } - public void DrawTransport(Graphics g) + public virtual void DrawTransport(Graphics g) { if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue) { diff --git a/WarmlyShip/WarmlyShip/DrawningMotorShip.cs b/WarmlyShip/WarmlyShip/DrawningMotorShip.cs new file mode 100644 index 0000000..d296623 --- /dev/null +++ b/WarmlyShip/WarmlyShip/DrawningMotorShip.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WarmlyShip +{ + internal class DrawningMotorShip : DrawingWarmlyShip + { + public DrawningMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) : base(speed, weight, bodyColor, 110, 60) + { + warmlyShip = new EntityMotorShip(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine); + } + + public override void DrawTransport(Graphics g) + { + if (warmlyShip is not EntityMotorShip sportCar) + { + return; + } + + } + } +} \ No newline at end of file diff --git a/WarmlyShip/WarmlyShip/EntityMotorShip.cs b/WarmlyShip/WarmlyShip/EntityMotorShip.cs new file mode 100644 index 0000000..55687e5 --- /dev/null +++ b/WarmlyShip/WarmlyShip/EntityMotorShip.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WarmlyShip +{ + internal class EntityMotorShip : EntityWarmlyShip + { + public Color DopColor { get; private set; } + public bool BodyKit { get; private set; } + public bool Wing { get; private set; } + public bool SportLine { get; private set; } + public EntityMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) : base(speed, weight, bodyColor) + { + DopColor = dopColor; + BodyKit = bodyKit; + Wing = wing; + SportLine = sportLine; + } + + } +} + \ No newline at end of file