Обновлен класс прорисовки продвинутого объекта
This commit is contained in:
parent
31a85c3479
commit
78ba3286f0
@ -26,19 +26,19 @@ namespace ProjectStormtrooper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Левая координата начала прорисовки
|
/// Левая координата начала прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _startPosX;
|
protected int _startPosX;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Верхняя координата начала прорисовки
|
/// Верхняя координата начала прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _startPosY;
|
protected int _startPosY;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина прорисовки
|
/// Ширина прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _planeWidth = 110;
|
protected readonly int _planeWidth = 110;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота прорисовки
|
/// Высота прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _planeHeight = 110;
|
protected readonly int _planeHeight = 110;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -153,7 +153,7 @@ namespace ProjectStormtrooper
|
|||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
public void DrawTransport(Graphics g)
|
public virtual void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityPlane == null)
|
if (EntityPlane == null)
|
||||||
{
|
{
|
||||||
|
@ -9,38 +9,10 @@ namespace ProjectStormtrooper
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
/// Класс отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawingStormtrooper
|
public class DrawingStormtrooper : DrawingPlane
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-сущность
|
/// Конструктор
|
||||||
/// </summary>
|
|
||||||
public EntityStormtrooper? EntityStormtrooper { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Левая координата начала прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private int _startPosX;
|
|
||||||
/// <summary>
|
|
||||||
/// Верхняя координата начала прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private int _startPosY;
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _stormtrooperWidth = 110;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота прорисовки
|
|
||||||
/// </summary>
|
|
||||||
private readonly int _stormtrooperHeight = 110;
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
/// <param name="weight">Вес</param>
|
/// <param name="weight">Вес</param>
|
||||||
@ -50,121 +22,45 @@ namespace ProjectStormtrooper
|
|||||||
/// <param name="bombs">Признак наличия бомб</param>
|
/// <param name="bombs">Признак наличия бомб</param>
|
||||||
/// <param name="width">Ширина картинки</param>
|
/// <param name="width">Ширина картинки</param>
|
||||||
/// <param name="height">Высота картинки</param>
|
/// <param name="height">Высота картинки</param>
|
||||||
/// <returns>true - если объект успешно создан, false - проверка не пройдена,
|
public DrawingStormtrooper(int speed, double weight, Color bodyColor,
|
||||||
/// т.к. нельзя создать объект в этих размерах</returns>
|
|
||||||
public bool Init(int speed, double weight, Color bodyColor,
|
|
||||||
Color additionalColor, bool rockets, bool bombs,
|
Color additionalColor, bool rockets, bool bombs,
|
||||||
int width, int height)
|
int width, int height) : base(speed, weight, bodyColor, width, height, 110, 110)
|
||||||
{
|
{
|
||||||
if (width < _stormtrooperWidth && height < _stormtrooperHeight)
|
if (EntityPlane != null)
|
||||||
{
|
{
|
||||||
return false;
|
EntityPlane = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, rockets, bombs);
|
||||||
}
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
EntityStormtrooper = new EntityStormtrooper();
|
|
||||||
EntityStormtrooper.Init(speed, weight, bodyColor, additionalColor, rockets, bombs);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Установка позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата X</param>
|
|
||||||
/// <param name="y">Координата Y</param>
|
|
||||||
public void SetPosition(int x, int y)
|
|
||||||
{
|
|
||||||
if (x < 0)
|
|
||||||
{
|
|
||||||
x = 0;
|
|
||||||
}
|
|
||||||
else if (x > _pictureWidth - _stormtrooperWidth)
|
|
||||||
{
|
|
||||||
x = _pictureWidth - _stormtrooperWidth;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
|
||||||
|
|
||||||
if (y < 0)
|
|
||||||
{
|
|
||||||
y = 0;
|
|
||||||
}
|
|
||||||
else if (y > _pictureHeight - _stormtrooperHeight)
|
|
||||||
{
|
|
||||||
y = _pictureHeight - _stormtrooperHeight;
|
|
||||||
}
|
|
||||||
_startPosY = y;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Перемещение объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">Направление перемещения</param>
|
|
||||||
public void MoveTransport(DirectionType direction)
|
|
||||||
{
|
|
||||||
if (EntityStormtrooper == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
// Вверх
|
|
||||||
case DirectionType.Up:
|
|
||||||
if (_startPosY - EntityStormtrooper.Step >= 0)
|
|
||||||
{
|
|
||||||
_startPosY -= (int)EntityStormtrooper.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Вниз
|
|
||||||
case DirectionType.Down:
|
|
||||||
if (_startPosY + _stormtrooperHeight + EntityStormtrooper.Step <= _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += (int)EntityStormtrooper.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Влево
|
|
||||||
case DirectionType.Left:
|
|
||||||
if (_startPosX - EntityStormtrooper.Step >= 0)
|
|
||||||
{
|
|
||||||
_startPosX -= (int)EntityStormtrooper.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Вправо
|
|
||||||
case DirectionType.Right:
|
|
||||||
if (_startPosX + _stormtrooperWidth + EntityStormtrooper.Step <= _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += (int)EntityStormtrooper.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="g"></param>
|
/// <param name="g"></param>
|
||||||
public void DrawTransport(Graphics g)
|
public override void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
if (EntityStormtrooper == null)
|
if (EntityPlane is not EntityStormtrooper stormtrooper)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Pen penBlack = new Pen(Color.Black);
|
Pen penBlack = new Pen(Color.Black);
|
||||||
Brush brushBlack = new SolidBrush(Color.Black);
|
Brush brushBlack = new SolidBrush(Color.Black);
|
||||||
Brush brushBodyColor = new SolidBrush(EntityStormtrooper.BodyColor);
|
Brush brushBodyColor = new SolidBrush(stormtrooper.BodyColor);
|
||||||
Brush brushAdditionalColor = new SolidBrush(EntityStormtrooper.AdditionalColor);
|
Brush brushAdditionalColor = new SolidBrush(stormtrooper.AdditionalColor);
|
||||||
|
|
||||||
// Высота фюзеляжа
|
// Высота фюзеляжа
|
||||||
int bodyHeight = _stormtrooperHeight / 9;
|
int bodyHeight = _planeHeight / 9;
|
||||||
|
|
||||||
// Рисуем бомбы
|
// Рисуем бомбы
|
||||||
if (EntityStormtrooper.Bombs)
|
if (stormtrooper.Bombs)
|
||||||
{
|
{
|
||||||
Point[] pointsBombTail = {
|
Point[] pointsBombTail = {
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 - 5,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 - 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2),
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 + 5,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 + 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2 - 5),
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2 - 5),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 + 5,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 + 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2 + 5),
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2 + 5),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8 + bodyHeight * 3 - 5,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 8 + bodyHeight * 3 - 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3 + bodyHeight / 2)
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3 + bodyHeight / 2)
|
||||||
};
|
};
|
||||||
|
|
||||||
g.FillPolygon(brushAdditionalColor, pointsBombTail);
|
g.FillPolygon(brushAdditionalColor, pointsBombTail);
|
||||||
@ -173,7 +69,7 @@ namespace ProjectStormtrooper
|
|||||||
for (int i = 0; i < pointsBombTail.Length; i++)
|
for (int i = 0; i < pointsBombTail.Length; i++)
|
||||||
{
|
{
|
||||||
Point p = pointsBombTail[i];
|
Point p = pointsBombTail[i];
|
||||||
p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY);
|
p.Y = _startPosY + _planeHeight - (p.Y - _startPosY);
|
||||||
pointsBombTail[i] = p;
|
pointsBombTail[i] = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,30 +77,30 @@ namespace ProjectStormtrooper
|
|||||||
g.DrawPolygon(penBlack, pointsBombTail);
|
g.DrawPolygon(penBlack, pointsBombTail);
|
||||||
|
|
||||||
g.FillEllipse(brushAdditionalColor,
|
g.FillEllipse(brushAdditionalColor,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8,
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3,
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3,
|
||||||
bodyHeight * 3,
|
bodyHeight * 3,
|
||||||
bodyHeight);
|
bodyHeight);
|
||||||
g.DrawEllipse(penBlack,
|
g.DrawEllipse(penBlack,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8,
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 - _stormtrooperHeight / 3,
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 - _planeHeight / 3,
|
||||||
bodyHeight * 3,
|
bodyHeight * 3,
|
||||||
bodyHeight);
|
bodyHeight);
|
||||||
|
|
||||||
g.FillEllipse(brushAdditionalColor,
|
g.FillEllipse(brushAdditionalColor,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8,
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 + _stormtrooperHeight / 3,
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 + _planeHeight / 3,
|
||||||
bodyHeight * 3,
|
bodyHeight * 3,
|
||||||
bodyHeight);
|
bodyHeight);
|
||||||
g.DrawEllipse(penBlack,
|
g.DrawEllipse(penBlack,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 8,
|
_startPosX + _planeWidth / 2 - _planeWidth / 8,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight / 2 + _stormtrooperHeight / 3,
|
_startPosY + _planeHeight / 2 - bodyHeight / 2 + _planeHeight / 3,
|
||||||
bodyHeight * 3,
|
bodyHeight * 3,
|
||||||
bodyHeight);
|
bodyHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Рисуем ракеты
|
// Рисуем ракеты
|
||||||
if (EntityStormtrooper.Rockets)
|
if (stormtrooper.Rockets)
|
||||||
{
|
{
|
||||||
int rocketWidth = bodyHeight * 4;
|
int rocketWidth = bodyHeight * 4;
|
||||||
int rocketHeight = bodyHeight / 2;
|
int rocketHeight = bodyHeight / 2;
|
||||||
@ -212,21 +108,21 @@ namespace ProjectStormtrooper
|
|||||||
Brush brushRed = new SolidBrush(Color.Red);
|
Brush brushRed = new SolidBrush(Color.Red);
|
||||||
|
|
||||||
Point[] pointsRocketCockPit = {
|
Point[] pointsRocketCockPit = {
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 - rocketHeight,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2),
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2),
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight)
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight)
|
||||||
};
|
};
|
||||||
|
|
||||||
Point[] pointsRocketTail = {
|
Point[] pointsRocketTail = {
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 - rocketHeight + rocketWidth - 10,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 - rocketHeight + rocketWidth - 10,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2),
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight / 2),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 + rocketWidth,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight * 2 + rocketHeight / 2),
|
_startPosY + _planeHeight / 2 - bodyHeight * 2 + rocketHeight / 2),
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5 + rocketWidth,
|
new Point(_startPosX + _planeWidth / 2 - _planeWidth / 5 + rocketWidth,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight + bodyHeight / 2 - rocketHeight / 2)
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2 + rocketHeight + bodyHeight / 2 - rocketHeight / 2)
|
||||||
};
|
};
|
||||||
|
|
||||||
g.FillPolygon(brushRed, pointsRocketCockPit);
|
g.FillPolygon(brushRed, pointsRocketCockPit);
|
||||||
@ -238,14 +134,14 @@ namespace ProjectStormtrooper
|
|||||||
for (int i = 0; i < pointsRocketCockPit.Length; i++)
|
for (int i = 0; i < pointsRocketCockPit.Length; i++)
|
||||||
{
|
{
|
||||||
Point p = pointsRocketCockPit[i];
|
Point p = pointsRocketCockPit[i];
|
||||||
p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY);
|
p.Y = _startPosY + _planeHeight - (p.Y - _startPosY);
|
||||||
pointsRocketCockPit[i] = p;
|
pointsRocketCockPit[i] = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pointsRocketTail.Length; i++)
|
for (int i = 0; i < pointsRocketTail.Length; i++)
|
||||||
{
|
{
|
||||||
Point p = pointsRocketTail[i];
|
Point p = pointsRocketTail[i];
|
||||||
p.Y = _startPosY + _stormtrooperHeight - (p.Y - _startPosY);
|
p.Y = _startPosY + _planeHeight - (p.Y - _startPosY);
|
||||||
pointsRocketTail[i] = p;
|
pointsRocketTail[i] = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,68 +152,29 @@ namespace ProjectStormtrooper
|
|||||||
g.DrawPolygon(penBlack, pointsRocketTail);
|
g.DrawPolygon(penBlack, pointsRocketTail);
|
||||||
|
|
||||||
g.FillRectangle(brushAdditionalColor,
|
g.FillRectangle(brushAdditionalColor,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5,
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2,
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2,
|
||||||
rocketWidth,
|
rocketWidth,
|
||||||
rocketHeight);
|
rocketHeight);
|
||||||
g.DrawRectangle(penBlack,
|
g.DrawRectangle(penBlack,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5,
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 - bodyHeight - bodyHeight / 2,
|
_startPosY + _planeHeight / 2 - bodyHeight - bodyHeight / 2,
|
||||||
rocketWidth,
|
rocketWidth,
|
||||||
rocketHeight);
|
rocketHeight);
|
||||||
|
|
||||||
g.FillRectangle(brushAdditionalColor,
|
g.FillRectangle(brushAdditionalColor,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5,
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 + bodyHeight / 2 + bodyHeight / 2,
|
_startPosY + _planeHeight / 2 + bodyHeight / 2 + bodyHeight / 2,
|
||||||
rocketWidth,
|
rocketWidth,
|
||||||
rocketHeight);
|
rocketHeight);
|
||||||
g.DrawRectangle(penBlack,
|
g.DrawRectangle(penBlack,
|
||||||
_startPosX + _stormtrooperWidth / 2 - _stormtrooperWidth / 5,
|
_startPosX + _planeWidth / 2 - _planeWidth / 5,
|
||||||
_startPosY + _stormtrooperHeight / 2 + bodyHeight / 2 + bodyHeight / 2,
|
_startPosY + _planeHeight / 2 + bodyHeight / 2 + bodyHeight / 2,
|
||||||
rocketWidth,
|
rocketWidth,
|
||||||
rocketHeight);
|
rocketHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Рисуем нос
|
base.DrawTransport(g);
|
||||||
|
|
||||||
Point[] pointsCockPit = {
|
|
||||||
new Point(_startPosX, _startPosY + _stormtrooperHeight / 2),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 + bodyHeight / 2)
|
|
||||||
};
|
|
||||||
|
|
||||||
g.FillPolygon(brushBlack, pointsCockPit);
|
|
||||||
|
|
||||||
// Рисуем крылья
|
|
||||||
|
|
||||||
Point[] pointsWings = {
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2, _startPosY),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 + _stormtrooperWidth / 15, _startPosY),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 + _stormtrooperWidth / 6, _startPosY + _stormtrooperHeight / 2),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 + _stormtrooperWidth / 15, _startPosY + _stormtrooperHeight),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth / 2 , _startPosY + _stormtrooperHeight)
|
|
||||||
};
|
|
||||||
|
|
||||||
g.FillPolygon(brushBodyColor, pointsWings);
|
|
||||||
g.DrawPolygon(penBlack, pointsWings);
|
|
||||||
|
|
||||||
// Рисуем хвостовое оперение
|
|
||||||
|
|
||||||
Point[] pointsTail = {
|
|
||||||
new Point(_startPosX + _stormtrooperWidth, _startPosY + _stormtrooperHeight / 2 - _stormtrooperHeight / 3),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth - _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - _stormtrooperHeight / 8),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth - _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 + _stormtrooperHeight / 8),
|
|
||||||
new Point(_startPosX + _stormtrooperWidth, _startPosY + _stormtrooperHeight / 2 + _stormtrooperHeight / 3)
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
g.FillPolygon(brushBodyColor, pointsTail);
|
|
||||||
g.DrawPolygon(penBlack, pointsTail);
|
|
||||||
|
|
||||||
// Рисуем фюзеляж
|
|
||||||
|
|
||||||
g.FillRectangle(brushBodyColor, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyHeight);
|
|
||||||
g.DrawRectangle(penBlack, _startPosX + _stormtrooperWidth / 8, _startPosY + _stormtrooperHeight / 2 - bodyHeight / 2, _stormtrooperWidth - _stormtrooperWidth / 8, bodyHeight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace ProjectStormtrooper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Bombs { get; private set; }
|
public bool Bombs { get; private set; }
|
||||||
public EntityStormtrooper(int speed, double weight, Color bodyColor,
|
public EntityStormtrooper(int speed, double weight, Color bodyColor,
|
||||||
Color additionalColor, bool rockets, bool bombs)
|
Color additionalColor, bool rockets, bool bombs) : base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
Rockets = rockets;
|
Rockets = rockets;
|
||||||
|
Loading…
Reference in New Issue
Block a user