2023-03-18 02:05:18 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Sailboat
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
|
|
|
/// </summary>
|
|
|
|
|
class DrawingSailboat : DrawingBoat
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Инициализация свойств
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">Вес автомобиля</param>
|
|
|
|
|
/// <param name="bodyColor">Цвет кузова</param>
|
|
|
|
|
/// <param name="sail">Признак наличия паруса</param>
|
|
|
|
|
/// <param name="extendedBody">Признак наличия усиленного корпуса</param>
|
|
|
|
|
public DrawingSailboat(int speed, float weight, Color bodyColor, bool sail, bool extendedBody) :
|
2023-03-18 02:49:20 +04:00
|
|
|
|
base(speed, weight, bodyColor, 80, 135)
|
2023-03-18 02:05:18 +04:00
|
|
|
|
{
|
|
|
|
|
Boat = new Sailboat(speed, weight, bodyColor, sail, extendedBody);
|
|
|
|
|
}
|
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
if (Boat is not Sailboat sailboat)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Pen pen = new(Color.Black);
|
|
|
|
|
Brush brush = new SolidBrush(Color.Black);
|
|
|
|
|
|
|
|
|
|
_startPosY += 40;
|
|
|
|
|
_startPosX += 20;
|
|
|
|
|
base.DrawTransport(g);
|
|
|
|
|
_startPosY -= 40;
|
|
|
|
|
_startPosX -= 20;
|
|
|
|
|
|
|
|
|
|
if (sailboat.Sail)
|
|
|
|
|
{
|
|
|
|
|
g.DrawLine(pen, _startPosX + 40, _startPosY, _startPosX + 60, _startPosY + 60);
|
|
|
|
|
g.DrawLine(pen, _startPosX + 40, _startPosY, _startPosX + 70, _startPosY + 30);
|
|
|
|
|
g.DrawLine(pen, _startPosX + 70, _startPosY + 30, _startPosX + 60, _startPosY + 55);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sailboat.ExtendedBody)
|
|
|
|
|
{
|
|
|
|
|
//корма
|
|
|
|
|
g.FillRectangle(brush, _startPosX + 15, _startPosY + 38, 70, 5);
|
|
|
|
|
g.FillRectangle(brush, _startPosX + 15, _startPosY + 78, 70, 5);
|
|
|
|
|
g.FillRectangle(brush, _startPosX + 15, _startPosY + 38, 5, 40);
|
|
|
|
|
//усиленный нос
|
|
|
|
|
g.FillRectangle(brush, _startPosX + 133, _startPosY + 55, 10, 10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|