66 lines
2.3 KiB
C#
66 lines
2.3 KiB
C#
|
using ProjectStormtrooper.Entities;
|
|||
|
|
|||
|
namespace ProjectStormtrooper.Drawnings;
|
|||
|
/// <summary>
|
|||
|
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
|||
|
/// </summary>
|
|||
|
public class DrawingStormtrooper: DrawingStormtrooperBase
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <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);
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <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);
|
|||
|
//ракеты штурмовика
|
|||
|
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);
|
|||
|
}
|
|||
|
base.DrawTransport(g);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|