Добавлены три реализации разных форм двигателя

This commit is contained in:
Данияр Аглиуллов 2022-09-22 07:02:39 +04:00
parent 8d19ef6890
commit 006cea0aca
3 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirBomber
{
internal class AirplaneArrowEngines : DrawningAirplaneEngines
{
protected override void DrawEngine(Graphics g, Color colorAirplane, RectangleF rectAroundEngine)
{
var x = rectAroundEngine.X + rectAroundEngine.Width / 4;
g.FillPolygon(new SolidBrush(colorAirplane), new PointF[]
{
new PointF(rectAroundEngine.Left, rectAroundEngine.Top + rectAroundEngine.Height / 2),
new PointF(x, rectAroundEngine.Top),
new PointF(x, rectAroundEngine.Bottom),
});
int margin = 2;
g.FillRectangle(new SolidBrush(colorAirplane),
x , rectAroundEngine.Top + margin,
rectAroundEngine.Right - x, rectAroundEngine.Height - margin * 2);
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirBomber
{
internal class AirplaneRectEngines : DrawningAirplaneEngines
{
protected override void DrawEngine(Graphics g, Color colorAirplane, RectangleF rectAroundEngine)
{
g.FillRectangle(new SolidBrush(colorAirplane), rectAroundEngine);
g.FillRectangle(new SolidBrush(Color.Black),
rectAroundEngine.Left, rectAroundEngine.Top, rectAroundEngine.Width / 4, rectAroundEngine.Height);
}
}
}

View File

@ -37,7 +37,7 @@ namespace AirBomber
}
}
private void DrawEngine(Graphics g, Color colorAirplane, RectangleF rectAroundEngine)
protected virtual void DrawEngine(Graphics g, Color colorAirplane, RectangleF rectAroundEngine)
{
g.FillEllipse(new SolidBrush(colorAirplane), rectAroundEngine);
g.FillEllipse(new SolidBrush(Color.Black),