Перерисовка крейсера

This commit is contained in:
Almaz 2024-04-10 00:34:32 +04:00
parent 1bde4734fc
commit 801caf48d3
2 changed files with 38 additions and 44 deletions

View File

@ -34,11 +34,11 @@ public class DrawningCruiser
/// <summary>
/// Ширина прорисовки крейсера
/// </summary>
private readonly int _drawningCruiserWidth = 90;
private readonly int _drawningCruiserWidth = 180;
/// <summary>
/// Высота прорисовки крейсера
/// </summary>
private readonly int _drawingCruiserHeight = 50;
private readonly int _drawingCruiserHeight = 70;
/// <summary>
/// Координата X объекта
@ -158,21 +158,20 @@ public class DrawningCruiser
Pen pen = new(Color.Black);
// Основной корпус крейсера
Brush Brush = new
SolidBrush(EntityCruiser.BodyColor);
//Границы крейсера
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value, 20, 20);
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 30, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 70, _startPosY.Value, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 70, _startPosY.Value + 30, 20, 20);
g.DrawRectangle(pen, _startPosX.Value + 1, _startPosY.Value + 10, 10, 30);
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 10, 10, 30);
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 1, 70, 52);
//кузов крейсера
Brush br = new SolidBrush(EntityCruiser.BodyColor);
g.FillRectangle(br, _startPosX.Value, _startPosY.Value + 10, 10, 30);
g.FillRectangle(br, _startPosX.Value + 80, _startPosY.Value + 10, 10, 30);
g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value, 70, 50);
Point[] hull = new Point[]
{
new Point((int)(_startPosX + 5), (int)(_startPosY + 10)),
new Point((int)(_startPosX + 110), (int)(_startPosY + 10)),
new Point((int)(_startPosX + 170), (int)(_startPosY + 40)),
new Point((int)(_startPosX + 110), (int)(_startPosY + 60)),
new Point((int)(_startPosX + 5), (int)(_startPosY + 60))
};
g.FillPolygon(Brush, hull);
g.DrawPolygon(pen, hull);
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -19,7 +20,7 @@ public class DrawningMilitaryCruiser: DrawningCruiser
/// <param name="bodyKit">Признак наличия обвеса</param>
/// <param name="armor">Признак наличия брони</param>
/// <param name="weapon">Признак наличия оружия</param>
public DrawningMilitaryCruiser(int speed, double weigth, Color bodyColor, Color additionalColor, bool bodyKit, bool armor, bool weapon): base(110, 60)
public DrawningMilitaryCruiser(int speed, double weigth, Color bodyColor, Color additionalColor, bool bodyKit, bool armor, bool weapon): base(180, 70)
{
EntityCruiser = new EntityMilitaryCruiser(speed, weigth, bodyColor, additionalColor, bodyKit, armor, weapon);
}
@ -33,36 +34,30 @@ public class DrawningMilitaryCruiser: DrawningCruiser
}
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(militaryCruiser.AdditionalColor);
//Границы крейсера
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 35, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 5, 20, 20);
g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 35, 20, 20);
g.DrawRectangle(pen, _startPosX.Value + 9, _startPosY.Value + 15, 10, 30);
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 4, 70, 52);
// Основной корпус парусника
Brush brush = new SolidBrush(militaryCruiser.BodyColor);
//кузов крейсера
Brush br = new SolidBrush(militaryCruiser.BodyColor);
g.FillRectangle(br, _startPosX.Value + 10, _startPosY.Value + 15, 10, 30);
g.FillRectangle(br, _startPosX.Value + 90, _startPosY.Value + 15, 10, 30);
g.FillRectangle(br, _startPosX.Value + 20, _startPosY.Value + 5, 70, 50);
_startPosX += 10;
_startPosY += 5;
base.DrawTransport(g);
_startPosX -= 10;
_startPosY -= 5;
// оружие крейсера
if (militaryCruiser.Weapon)
Point[] hull = new Point[]
{
g.FillRectangle(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 23, 25, 15);
g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 23, 35, 15);
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 23, 20, 15);
new Point((int)(_startPosX + 5), (int)(_startPosY + 10)),
new Point((int)(_startPosX + 110), (int)(_startPosY + 10)),
new Point((int)(_startPosX + 170), (int)(_startPosY + 40)),
new Point((int)(_startPosX + 110), (int)(_startPosY + 60)),
new Point((int)(_startPosX + 5), (int)(_startPosY + 60))
};
g.FillPolygon(brush, hull);
g.DrawPolygon(pen, hull);
base.DrawTransport(g);
//Взлетная полоса
Brush additionalBrush = new SolidBrush(militaryCruiser.AdditionalColor);
g.FillEllipse(additionalBrush, (int)(_startPosX + 100), (int)(_startPosY + 25), 20, 20);
g.DrawEllipse(pen, (int)(_startPosX + 100), (int)(_startPosY + 25), 20, 20);
//Рокетная шахта
g.FillRectangle(additionalBrush, (int)(_startPosX + 70), (int)(_startPosY + 20), 20, 30);
g.FillRectangle(additionalBrush, (int)(_startPosX + 40), (int)(_startPosY + 27), 30, 15);
}
}
}