2023-10-08 21:06:26 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2023-10-11 09:42:48 +04:00
|
|
|
|
using System.Drawing;
|
2023-10-08 21:06:26 +04:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-10-11 09:42:48 +04:00
|
|
|
|
|
2023-10-08 21:06:26 +04:00
|
|
|
|
using Hydroplane.Entities;
|
|
|
|
|
|
|
|
|
|
namespace Hydroplane.DrawningObjects
|
|
|
|
|
{
|
|
|
|
|
public class DrawningHydroplane : DrawningPlane
|
|
|
|
|
{
|
|
|
|
|
public DrawningHydroplane(int speed, double weight, Color bodyColor, Color
|
2023-10-11 09:42:48 +04:00
|
|
|
|
additionalColor, bool boat, bool bobber, int width, int height) :
|
|
|
|
|
base(speed, weight, bodyColor, width, height)
|
2023-10-08 21:06:26 +04:00
|
|
|
|
{
|
|
|
|
|
if (EntityPlane != null)
|
|
|
|
|
{
|
|
|
|
|
EntityPlane = new EntityHydroplane(speed, weight, bodyColor,
|
|
|
|
|
additionalColor, boat, bobber);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
if (EntityPlane is not EntityHydroplane hydroplane)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Pen pen = new(Color.Black);
|
2023-10-11 09:42:48 +04:00
|
|
|
|
Brush bodyBrush = new SolidBrush(EntityPlane.BodyColor);
|
2023-10-08 21:06:26 +04:00
|
|
|
|
Brush additionalBrush = new
|
|
|
|
|
SolidBrush(hydroplane.AdditionalColor);
|
|
|
|
|
|
2023-10-11 09:42:48 +04:00
|
|
|
|
base.DrawTransport(g);
|
|
|
|
|
|
2023-10-08 21:06:26 +04:00
|
|
|
|
//раскраска иллюминаторов
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX + 40, _startPosY + 30, 10, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX + 60, _startPosY + 30, 10, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX + 80, _startPosY + 30, 10, 10);
|
|
|
|
|
|
|
|
|
|
//раскраска окна
|
|
|
|
|
g.FillPolygon(additionalBrush, new[]
|
|
|
|
|
{
|
|
|
|
|
new Point(_startPosX + 160, _startPosY + 40),
|
|
|
|
|
new Point(_startPosX + 130, _startPosY + 40),
|
|
|
|
|
new Point(_startPosX + 130, _startPosY + 25) });
|
|
|
|
|
|
2023-10-11 09:42:48 +04:00
|
|
|
|
//раскраска ножек
|
|
|
|
|
g.FillRectangle(bodyBrush, _startPosX + 65, _startPosY + 55, 5, 15);
|
|
|
|
|
g.FillRectangle(bodyBrush, _startPosX + 125, _startPosY + 55, 5, 15);
|
|
|
|
|
|
|
|
|
|
//ножки снизу
|
|
|
|
|
g.DrawLine(pen, _startPosX + 65, _startPosY + 55, _startPosX + 65, _startPosY + 70);
|
|
|
|
|
g.DrawLine(pen, _startPosX + 70, _startPosY + 55, _startPosX + 70, _startPosY + 70);
|
|
|
|
|
g.DrawLine(pen, _startPosX + 125, _startPosY + 55, _startPosX + 125, _startPosY + 70);
|
|
|
|
|
g.DrawLine(pen, _startPosX + 130, _startPosY + 55, _startPosX + 130, _startPosY + 70);
|
|
|
|
|
|
|
|
|
|
|
2023-10-08 21:06:26 +04:00
|
|
|
|
//поплавки(лыжи) или колеса
|
|
|
|
|
if (hydroplane.Bobber)
|
|
|
|
|
{
|
|
|
|
|
g.FillPolygon(additionalBrush, new[]
|
|
|
|
|
{
|
|
|
|
|
new Point(_startPosX + 55, _startPosY + 70),
|
|
|
|
|
new Point(_startPosX + 55, _startPosY + 80),
|
|
|
|
|
new Point(_startPosX + 155, _startPosY + 80),
|
|
|
|
|
new Point(_startPosX + 175, _startPosY + 70) });
|
|
|
|
|
|
|
|
|
|
g.DrawPolygon(pen, new[]
|
|
|
|
|
{
|
|
|
|
|
new Point(_startPosX + 55, _startPosY + 70),
|
|
|
|
|
new Point(_startPosX + 55, _startPosY + 80),
|
|
|
|
|
new Point(_startPosX + 155, _startPosY + 80),
|
|
|
|
|
new Point(_startPosX + 175, _startPosY + 70) });
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX + 60, _startPosY + 70, 15, 15);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX + 120, _startPosY + 70, 15, 15);
|
|
|
|
|
|
|
|
|
|
g.DrawEllipse(pen, _startPosX + 60, _startPosY + 70, 15, 15);
|
|
|
|
|
g.DrawEllipse(pen, _startPosX + 120, _startPosY + 70, 15, 15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//надувная лодка
|
|
|
|
|
if (hydroplane.Boat)
|
|
|
|
|
{
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX, _startPosY + 21, 32, 8);
|
|
|
|
|
g.DrawEllipse(pen, _startPosX, _startPosY + 21, 32, 8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|