Подкорректированы размеры самолетов и ангара

This commit is contained in:
Данияр Аглиуллов 2022-09-30 18:24:01 +04:00
parent 958cddcd6a
commit 1d3cf33ca3
2 changed files with 18 additions and 7 deletions

View File

@ -20,7 +20,7 @@ namespace AirBomber
/// <param name="hasBombs">Признак наличия бомб</param>
/// <param name="hasFuelTanks">Признак наличия топливных баков</param>
public DrawningAirBomber(int speed, float weight, Color bodyColor, Color dopColor, bool hasBombs, bool hasFuelTanks)
: base(speed, weight, bodyColor, 115, 155)
: base(speed, weight, bodyColor, 95, 110)
{
Airplane = new EntityAirBomber(speed, weight, bodyColor, dopColor, hasBombs, hasFuelTanks);
}

View File

@ -25,7 +25,7 @@ namespace AirBomber
/// <summary>
/// Размер занимаемого объектом места (высота)
/// </summary>
private readonly int _placeSizeHeight = 90;
private readonly int _placeSizeHeight = 190;
/// <summary>
/// Набор объектов
/// </summary>
@ -147,13 +147,24 @@ namespace AirBomber
Pen pen = new(Color.Black, 3);
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
{//линия рамзетки места
g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; j++)
{
DrawHangar(g, pen, new RectangleF(i * _placeSizeWidth, j * _placeSizeHeight, _placeSizeWidth / 1.8F, _placeSizeHeight / 1.6F));
// g.DrawLine(pen, i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
}
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
}
}
private void DrawHangar(Graphics g, Pen pen, RectangleF rect)
{
g.DrawLine(pen, rect.Left , rect.Top , rect.Right, rect.Top );
g.DrawLine(pen, rect.Right, rect.Top , rect.Right, rect.Bottom);
g.DrawLine(pen, rect.Right, rect.Bottom, rect.Left , rect.Bottom);
// Края ворот ангара
g.DrawLine(pen, rect.Left, rect.Top , rect.Left, rect.Top + rect.Height / 10);
g.DrawLine(pen, rect.Left, rect.Bottom, rect.Left, rect.Bottom - rect.Height / 10);
}
/// <summary>
/// Метод прорисовки объектов
/// </summary>
@ -165,7 +176,7 @@ namespace AirBomber
for (int i = 0; i < _setAirplanes.Count; i++)
{
var airplane = _setAirplanes.Get(i);
airplane?.SetObject(maxLeft - i % countInLine * _placeSizeWidth, i / countInLine * _placeSizeHeight, _pictureWidth, _pictureHeight);
airplane?.SetObject(maxLeft - i % countInLine * _placeSizeWidth, i / countInLine * _placeSizeHeight + 3, _pictureWidth, _pictureHeight);
airplane?.DrawningObject(g);
}
}