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

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

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -19,7 +20,7 @@ public class DrawningMilitaryCruiser: DrawningCruiser
/// <param name="bodyKit">Признак наличия обвеса</param> /// <param name="bodyKit">Признак наличия обвеса</param>
/// <param name="armor">Признак наличия брони</param> /// <param name="armor">Признак наличия брони</param>
/// <param name="weapon">Признак наличия оружия</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); EntityCruiser = new EntityMilitaryCruiser(speed, weigth, bodyColor, additionalColor, bodyKit, armor, weapon);
} }
@ -33,36 +34,30 @@ public class DrawningMilitaryCruiser: DrawningCruiser
} }
Pen pen = new(Color.Black); Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(militaryCruiser.AdditionalColor);
//Границы крейсера // Основной корпус парусника
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 5, 20, 20); Brush brush = new SolidBrush(militaryCruiser.BodyColor);
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);
//кузов крейсера Point[] hull = new Point[]
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)
{ {
g.FillRectangle(additionalBrush, _startPosX.Value + 75, _startPosY.Value + 23, 25, 15); new Point((int)(_startPosX + 5), (int)(_startPosY + 10)),
g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 23, 35, 15); new Point((int)(_startPosX + 110), (int)(_startPosY + 10)),
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 23, 20, 15); 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);
}
} }
} }