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