2024-03-05 09:00:55 +04:00
|
|
|
|
using ProjectStormtrooper.Entities;
|
|
|
|
|
|
|
|
|
|
namespace ProjectStormtrooper.Drawnings;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
|
|
|
|
/// </summary>
|
2024-03-09 20:45:03 +04:00
|
|
|
|
public class DrawingStormtrooper: DrawningStormtrooperBase
|
2024-03-05 09:00:55 +04:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Конструктор
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed"></param>
|
|
|
|
|
/// <param name="weight"></param>
|
|
|
|
|
/// <param name="bodyColor"></param>
|
|
|
|
|
/// <param name="additionalColor"></param>
|
|
|
|
|
/// <param name="rockets"></param>
|
|
|
|
|
/// <param name="bombs"></param>
|
|
|
|
|
|
|
|
|
|
public DrawingStormtrooper(int speed,double weight, Color bodyColor,Color additionalColor, bool rockets, bool bombs):base(140,140)
|
|
|
|
|
{
|
|
|
|
|
EntityStormtrooperBase = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, rockets, bombs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-04-30 11:26:54 +04:00
|
|
|
|
public DrawingStormtrooper(EntityStormtrooper entityStormtrooperBase) : base(140, 135)
|
|
|
|
|
{
|
|
|
|
|
EntityStormtrooperBase = new EntityStormtrooper(entityStormtrooperBase.Speed, entityStormtrooperBase.Weight, entityStormtrooperBase.BodyColor, entityStormtrooperBase.AdditionalColor, entityStormtrooperBase.Bombs, entityStormtrooperBase.Rockets);
|
|
|
|
|
}
|
2024-03-05 09:00:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Прорисовка объекта
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="q"></param>
|
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
if (EntityStormtrooperBase == null || EntityStormtrooperBase is not EntityStormtrooper stormtrooper || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Pen pen = new(Color.Black);
|
|
|
|
|
Brush additionalBrush = new SolidBrush(stormtrooper.AdditionalColor);
|
2024-03-09 20:45:03 +04:00
|
|
|
|
base.DrawTransport(g);
|
2024-03-05 09:00:55 +04:00
|
|
|
|
//ракеты штурмовика
|
|
|
|
|
if (stormtrooper.Rockets)
|
|
|
|
|
{
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5);
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5);
|
|
|
|
|
}
|
|
|
|
|
//бомбы штурмовика
|
|
|
|
|
if (stormtrooper.Bombs)
|
|
|
|
|
{
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10);
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10);
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10);
|
|
|
|
|
}
|
2024-03-09 20:45:03 +04:00
|
|
|
|
|
2024-03-05 09:00:55 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|