using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class DrawingCatamaran : DrawingBoat
{
///
/// Инициализация свойств
///
/// Скорость
/// Вес автомобиля
/// Цвет кузова
/// Дополнительный цвет
/// Признак наличия обвеса
/// Признак наличия антикрыла
public DrawingCatamaran(int speed, float weight, Color bodyColor, Color
dopColor, bool Floats, bool Sail) :
base(speed, weight, bodyColor, 110, 60)
{
Catamaran = new EntityCatamaran(speed, weight, bodyColor, dopColor, Floats,
Sail);
}
public override void DrawTransport(Graphics g)
{
if (!(Catamaran is EntityCatamaran catamaranPro))
{
return;
}
Pen pen = new Pen(Color.Black);
Brush dopBrush = new SolidBrush(catamaranPro.DopColor);
if (catamaranPro.Floats)
{
g.DrawEllipse(pen, _startPosX, _startPosY, (int)(_catamaranWidth / 2), (int)(_catamaranHeight / 2));
g.FillEllipse(dopBrush, _startPosX, _startPosY, (int)(_catamaranWidth / 2), (int)(_catamaranHeight / 2));
g.DrawEllipse(pen, _startPosX, 10 + _startPosY + (int)(_catamaranHeight / 2), (int)(_catamaranWidth / 2), (int)(_catamaranHeight / 2));
g.FillEllipse(dopBrush, _startPosX, 10 + _startPosY + (int)(_catamaranHeight / 2), (int)(_catamaranWidth / 2), (int)(_catamaranHeight / 2));
}
_startPosX += 10;
_startPosY += 5;
base.DrawTransport(g);
_startPosX -= 10;
_startPosY -= 5;
if (catamaranPro.Sail)
{
Point point_1 = new Point((int)(_startPosX + _catamaranWidth * 2 / 4), (int)_startPosY + 5);
Point point_2 = new Point((int)(_startPosX + _catamaranWidth), (int)(_startPosY + _catamaranHeight / 2));
Point point_3 = new Point((int)(_startPosX + _catamaranWidth * 2 / 4), (int)(_startPosY + _catamaranHeight));
Point[] pointsArray = { point_1, point_2, point_3 };
g.DrawPolygon(pen, pointsArray);
g.FillPolygon(dopBrush, pointsArray);
}
}
}
}