93 lines
3.8 KiB
C#
93 lines
3.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Hydroplane.Entities;
|
|||
|
|
|||
|
namespace Hydroplane.DrawningObjects
|
|||
|
{
|
|||
|
public class DrawningHydroplane : DrawningPlane
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Конструктор
|
|||
|
/// </summary>
|
|||
|
/// <param name="speed">Скорость</param>
|
|||
|
/// <param name="weight">Вес</param>
|
|||
|
/// <param name="bodyColor">Основной цвет</param>
|
|||
|
/// <param name="width">Ширина картинки</param>
|
|||
|
/// <param name="height">Высота картинки</param>
|
|||
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
|||
|
/// <param name="boat">Признак наличия надувной лодки</param>
|
|||
|
/// <param name="bobber">Признак наличия поплавков</param>
|
|||
|
/// <param name="width">Ширина картинки</param>
|
|||
|
/// <param name="height">Высота картинки</param>
|
|||
|
public DrawningHydroplane(int speed, double weight, Color bodyColor, Color
|
|||
|
additionalColor, bool boat, bool bobber, int width, int height) :
|
|||
|
base(speed, weight, bodyColor, width, height, 110, 60)
|
|||
|
{
|
|||
|
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);
|
|||
|
Brush additionalBrush = new
|
|||
|
SolidBrush(hydroplane.AdditionalColor);
|
|||
|
|
|||
|
//раскраска иллюминаторов
|
|||
|
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) });
|
|||
|
|
|||
|
//поплавки(лыжи) или колеса
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|