66 lines
2.6 KiB
C#
66 lines
2.6 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace Battleship
|
||
{
|
||
internal class DrawningGunBattleship : DrawningBattleship
|
||
{
|
||
/// <summary>
|
||
/// Инициализация свойств
|
||
/// </summary>
|
||
/// <param name="speed">Скорость</param>
|
||
/// <param name="weight">Вес военного корабля</param>
|
||
/// <param name="bodyColor">Цвет корпуса корабля</param>
|
||
/// <param name="dopColor">Дополнительный цвет</param>
|
||
/// <param name="compartmentRocket">Признак наличия отсека для ракет</param>
|
||
/// <param name="gunTower">Признак наличия орудийной башни</param>
|
||
/// <param name="sternFence">Признак наличия забора на корме</param>
|
||
public DrawningGunBattleship(int speed, float weight, Color bodyColor, Color dopColor, bool compartmentRocket, bool gunTower, bool sternFence) :
|
||
base(speed, weight, bodyColor, 140, 40)
|
||
{
|
||
Battleship = new EntityGunBattleship(speed, weight, bodyColor, dopColor, compartmentRocket, gunTower, sternFence);
|
||
}
|
||
public override void DrawTransport(Graphics g)
|
||
{
|
||
if (Battleship is not EntityGunBattleship gunBattleship)
|
||
{
|
||
return;
|
||
}
|
||
|
||
Pen pen = new(Color.Black);
|
||
Brush dopBrush = new SolidBrush(gunBattleship.DopColor);
|
||
|
||
if (gunBattleship.CompartmentRocket)
|
||
{
|
||
g.FillRectangle(dopBrush, _startPosX + 85, _startPosY + 10, 15, 20);
|
||
|
||
g.DrawRectangle(pen, _startPosX + 85, _startPosY + 10, 15, 20);
|
||
}
|
||
|
||
_startPosX += 10;
|
||
_startPosY += 5;
|
||
base.DrawTransport(g);
|
||
_startPosX -= 10;
|
||
_startPosY -= 5;
|
||
|
||
if (gunBattleship.GunTower)
|
||
{
|
||
g.FillEllipse(dopBrush, _startPosX + 105, _startPosY + 12, 17, 17);
|
||
g.FillRectangle(dopBrush, _startPosX + 121, _startPosY + 17, 11, 7);
|
||
|
||
g.DrawEllipse(pen, _startPosX + 105, _startPosY + 12, 17, 17);
|
||
g.DrawRectangle(pen, _startPosX + 121, _startPosY + 17, 11, 7);
|
||
}
|
||
|
||
if (gunBattleship.SternFence)
|
||
{
|
||
g.FillRectangle(dopBrush, _startPosX + 13, _startPosY + 8, 5, 25);
|
||
g.DrawRectangle(pen, _startPosX + 13, _startPosY + 8, 5, 25);
|
||
}
|
||
}
|
||
}
|
||
}
|