LabWork02 #3

Closed
Inohara wants to merge 9 commits from LabWork02 into LabWork1
3 changed files with 96 additions and 2 deletions
Showing only changes of commit 7f1f1ca3e4 - Show all commits

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AircraftCarrier
{
internal class DrawingAircraftCarrier : DrawingWarship
{
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="dopColor">Дополнительный цвет</param>
/// <param name="bodyKit">Признак наличия обвеса</param>
/// <param name="wing">Признак наличия антикрыла</param>
/// <param name="sportLine">Признак наличия гоночной полосы</param>
public DrawingAircraftCarrier(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) :
base(speed, weight, bodyColor, 110, 60)
{
Warship = new EntityAircraftCarrier(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine);
}
public override void DrawTransport(Graphics g)
{
base.DrawTransport(g);
}
}
}

View File

@ -14,7 +14,7 @@ namespace AircraftCarrier
/// <summary>
/// Класс-сущность
/// </summary>
public EntityWarship Warship { get; private set; }
public EntityWarship Warship { get; protected set; }
/// <summary>
/// Левая координата отрисовки военного корабля
/// </summary>
@ -49,6 +49,21 @@ namespace AircraftCarrier
{
Warship = new EntityWarship(speed, weight, bodyColor);
}
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес военного корабля</param>
/// <param name="bodyColor">Цвет главной палубы</param>
/// <param name="carWidth">Ширина отрисовки автомобиля</param>
/// <param name="carHeight">Высота отрисовки автомобиля</param>
protected DrawingWarship(int speed, float weight, Color bodyColor, int warshipWidth, int warshipHeight) :
this(speed, weight, bodyColor)
{
_warshipWidth = warshipWidth;
_warshipHeight = warshipHeight;
}
/// <summary>
/// Установка позиции военного корабля
/// </summary>
@ -127,7 +142,7 @@ namespace AircraftCarrier
/// Отрисовка военного корабля
/// </summary>
/// <param name="g"></param>
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,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AircraftCarrier
{
internal class EntityAircraftCarrier : EntityWarship
{
/// <summary>
/// Дополнительный цвет
/// </summary>
public Color DopColor { get; private set; }
/// <summary>
/// Признак наличия обвеса
/// </summary>
public bool BodyKit { get; private set; }
/// <summary>
/// Признак наличия антикрыла
/// </summary>
public bool Wing { get; private set; }
/// <summary>
/// Признак наличия гоночной полосы
/// </summary>
public bool SportLine { get; private set; }
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="dopColor">Дополнительный цвет</param>
/// <param name="bodyKit">Признак наличия обвеса</param>
/// <param name="wing">Признак наличия антикрыла</param>
/// <param name="sportLine">Признак наличия гоночной полосы</param>
public EntityAircraftCarrier(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;
}
}
}