49 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ship
{
internal class DrawingMotorShip : DrawingShip
{
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="dopColor">Дополнительный цвет</param>
/// <param name="pipes">Признак наличия труб</param>
/// <param name="fuelTank">Признак наличия отсека для топлива</param>
public DrawingMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool pipes, bool fuelTank) : base(speed, weight, bodyColor, 110, 60)
{
Ship = new EntityMotorShip(speed, weight, bodyColor, dopColor, pipes, fuelTank);
}
public override void DrawTransport(Graphics g)
{
if (Ship is not EntityMotorShip motorShip)
{
return;
}
Pen pen = new(Color.Black);
Brush dopBrush = new SolidBrush(motorShip.DopColor);
if (motorShip.Pipes)
{
g.FillRectangle(dopBrush, _startPosX + 20, _startPosY + 20, 10, 30);
g.FillRectangle(dopBrush, _startPosX + 40, _startPosY + 10, 10, 40);
g.FillRectangle(dopBrush, _startPosX + 60, _startPosY + 20, 10, 30);
}
_startPosY += 40;
base.DrawTransport(g);
_startPosY -= 40;
if (motorShip.Fueltank)
{
g.FillEllipse(dopBrush, _startPosX + 40, _startPosY + 55, 20, 10);
}
}
}
}