Сохранил изменения

This commit is contained in:
Макс Бондаренко 2022-09-21 10:49:05 +04:00
parent d35b31c29c
commit 33d1b6d846
3 changed files with 60 additions and 4 deletions

View File

@ -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)
{

View File

@ -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;
}
}
}
}

View File

@ -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;
}
}
}