74 lines
3.0 KiB
C#
74 lines
3.0 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using ProjectSeaplane.Entities;
|
||
|
||
namespace ProjectSeaplane.Drawings;
|
||
public class DrawingSeaplane : DrawingPlane
|
||
{
|
||
public DrawingSeaplane(int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool inflatableBoat) : base(190, 85)
|
||
{
|
||
EntityPlane = new EntitySeaplane(speed, weight, bodyColor, additionalColor, floats, inflatableBoat);
|
||
}
|
||
|
||
public DrawingSeaplane(EntitySeaplane plane) : base(190, 85)
|
||
{
|
||
EntityPlane = new EntitySeaplane(plane.Speed, plane.Weight, plane.BodyColor, plane.AdditionalColor, plane.Floats, plane.InflatableBoat);
|
||
}
|
||
|
||
public override void DrawTransport(Graphics g)
|
||
{
|
||
if (EntityPlane == null || EntityPlane is not EntitySeaplane seaplane || !_startPosX.HasValue || !_startPosY.HasValue)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Pen pen = new(Color.Black);
|
||
Brush additionalBrush = new SolidBrush(seaplane.AdditionalColor);
|
||
Brush brBlack = new SolidBrush(Color.Black);
|
||
Brush brRed = new SolidBrush(Color.Red);
|
||
|
||
if (!seaplane.Floats)
|
||
{
|
||
// Рисуем переднее шасси с одним колесом
|
||
g.DrawEllipse(pen, _startPosX.Value + 140, _startPosY.Value + 75, 10, 10);
|
||
|
||
// Рисуем задние шасси с двумя колесами
|
||
g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 75, 10, 10);
|
||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 75, 10, 10);
|
||
|
||
// Рисуем ногу переднего шасси
|
||
g.DrawLine(pen, _startPosX.Value + 145, _startPosY.Value + 65, _startPosX.Value + 145, _startPosY.Value + 80);
|
||
|
||
// Рисуем ноги заднего шасси
|
||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 65, _startPosX.Value + 30, _startPosY.Value + 80);
|
||
}
|
||
|
||
base.DrawTransport(g);
|
||
|
||
// Поплавки
|
||
if (seaplane.Floats)
|
||
{
|
||
g.DrawLine(pen, _startPosX.Value + 125, _startPosY.Value + 65, _startPosX.Value + 125, _startPosY.Value + 80);
|
||
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 65, _startPosX.Value + 50, _startPosY.Value + 80);
|
||
g.FillEllipse(additionalBrush, _startPosX.Value + 40, _startPosY.Value + 75, 10, 10);
|
||
g.FillEllipse(additionalBrush, _startPosX.Value + 125, _startPosY.Value + 75, 10, 10);
|
||
g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 75, 85, 10);
|
||
|
||
}
|
||
|
||
// Надувная лодка
|
||
if (seaplane.InflatableBoat)
|
||
{
|
||
g.FillEllipse(brRed, _startPosX.Value, _startPosY.Value + 60, 8, 8);
|
||
g.FillEllipse(brRed, _startPosX.Value + 165, _startPosY.Value + 60, 8, 8);
|
||
g.FillRectangle(brRed, _startPosX.Value + 4, _startPosY.Value + 60, 165, 8);
|
||
}
|
||
|
||
}
|
||
}
|
||
|