Compare commits
No commits in common. "ec08a44682cc1ed06d0b9525d8c1afadee88c82f" and "00d9cfc7d1d78357508ecebf72823e560a17bff8" have entirely different histories.
ec08a44682
...
00d9cfc7d1
@ -8,8 +8,8 @@ namespace AirBomber
|
||||
{
|
||||
public class DrawningAirBomber : DrawningAirPlane
|
||||
{
|
||||
public DrawningAirBomber(int speed, double weight, Color bodyColor, Color additionalColor, bool bombs, bool fuelTanks, int width, int height, int engines, int enginesShape) :
|
||||
base(speed, weight, bodyColor, width, height, engines, enginesShape)
|
||||
public DrawningAirBomber(int speed, double weight, Color bodyColor, Color additionalColor, bool bombs, bool fuelTanks, int width, int height) :
|
||||
base(speed, weight, bodyColor, width, height, 160, 118)
|
||||
{
|
||||
if (EntityAirPlane != null)
|
||||
{
|
||||
@ -26,17 +26,17 @@ namespace AirBomber
|
||||
Brush additionalBrush = new SolidBrush(airBomber.AdditionalColor);
|
||||
base.DrawPlane(g);
|
||||
// bombs
|
||||
g.FillEllipse(additionalBrush, _startPosX + 90, _startPosY + 20, 15, 29);
|
||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 20, 15, 29);
|
||||
g.FillEllipse(additionalBrush, _startPosX + 90, _startPosY + 70, 15, 29);
|
||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 70, 15, 29);
|
||||
g.FillEllipse(additionalBrush, _startPosX + 140, _startPosY + 50, 15, 15);
|
||||
g.DrawEllipse(pen, _startPosX + 140, _startPosY + 50, 15, 15);
|
||||
g.FillEllipse(additionalBrush, _startPosX + 140, _startPosY + 30, 15, 15);
|
||||
g.DrawEllipse(pen, _startPosX + 140, _startPosY + 30, 15, 15);
|
||||
g.FillEllipse(additionalBrush, _startPosX + 140, _startPosY + 70, 15, 15);
|
||||
g.DrawEllipse(pen, _startPosX + 140, _startPosY + 70, 15, 15);
|
||||
// fueltanks
|
||||
g.FillRectangle(additionalBrush, _startPosX + 85, _startPosY + 34, 30, 15);
|
||||
g.DrawRectangle(pen, _startPosX + 85, _startPosY + 34, 30, 15);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 85, _startPosY + 70, 30, 15);
|
||||
g.DrawRectangle(pen, _startPosX + 85, _startPosY + 70, 30, 15);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 63, _startPosY + 34, 20, 15);
|
||||
g.DrawRectangle(pen, _startPosX + 63, _startPosY + 34, 20, 15);
|
||||
g.FillRectangle(additionalBrush, _startPosX + 63, _startPosY + 70, 20, 15);
|
||||
g.DrawRectangle(pen, _startPosX + 63, _startPosY + 70, 20, 15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,7 @@ namespace AirBomber
|
||||
protected int _startPosY;
|
||||
protected readonly int _airPlaneWidth = 150;
|
||||
protected readonly int _airPlaneHeight = 118;
|
||||
private IDrawningEngines drawningEngines;
|
||||
public DrawningAirPlane(int speed, double weight, Color bodyColor, int width, int height, int engines, int enginesShape)
|
||||
public DrawningAirPlane(int speed, double weight, Color bodyColor, int width, int height)
|
||||
{
|
||||
if (width < _airPlaneWidth || height < _airPlaneHeight)
|
||||
{
|
||||
@ -25,19 +24,18 @@ namespace AirBomber
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityAirPlane = new EntityAirPlane(speed, weight, bodyColor);
|
||||
switch (enginesShape)
|
||||
}
|
||||
protected DrawningAirPlane(int speed, double weight, Color bodyColor, int width, int height, int airPlaneWidth, int airPlaneHeight)
|
||||
{
|
||||
if (width < _airPlaneWidth || height < _airPlaneHeight)
|
||||
{
|
||||
case 1:
|
||||
drawningEngines = new DrawningEnginesCircle();
|
||||
break;
|
||||
case 2:
|
||||
drawningEngines = new DrawningEnginesTriangle();
|
||||
break;
|
||||
default:
|
||||
drawningEngines = new DrawningEnginesRectangle();
|
||||
break;
|
||||
return;
|
||||
}
|
||||
drawningEngines.SetAmount(engines);
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_airPlaneWidth = airPlaneWidth;
|
||||
_airPlaneHeight = airPlaneHeight;
|
||||
EntityAirPlane = new EntityAirPlane(speed, weight, bodyColor);
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
@ -142,7 +140,6 @@ namespace AirBomber
|
||||
new Point(_startPosX + 140, _startPosY + 70),
|
||||
}
|
||||
);
|
||||
drawningEngines.DrawEngines(g, _startPosX, _startPosY);
|
||||
}
|
||||
public int GetPosX => _startPosX;
|
||||
public int GetPosY => _startPosY;
|
||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
public class DrawningEnginesRectangle : IDrawningEngines
|
||||
internal class DrawningEngines
|
||||
{
|
||||
private Engines amount;
|
||||
public void SetAmount(int a)
|
@ -1,94 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
public class DrawningEnginesCircle : IDrawningEngines
|
||||
{
|
||||
private Engines amount;
|
||||
public void SetAmount(int a)
|
||||
{
|
||||
if (a <= 2)
|
||||
{
|
||||
amount = Engines.Two;
|
||||
}
|
||||
else if (a == 4)
|
||||
{
|
||||
amount = Engines.Four;
|
||||
}
|
||||
else if (a >= 6)
|
||||
{
|
||||
amount = Engines.Six;
|
||||
}
|
||||
}
|
||||
public void DrawEngines(Graphics g, int _startPosX, int _startPosY)
|
||||
{
|
||||
Brush enginesColor = new SolidBrush(Color.Black);
|
||||
|
||||
g.FillPolygon(enginesColor, new Point[] //two up
|
||||
{
|
||||
new Point(_startPosX + 51, _startPosY + 30),
|
||||
new Point(_startPosX + 75, _startPosY + 30),
|
||||
new Point(_startPosX + 75, _startPosY + 40),
|
||||
new Point(_startPosX + 53, _startPosY + 40),
|
||||
}
|
||||
);
|
||||
g.FillEllipse(enginesColor, _startPosX + 71, _startPosY + 28, 13, 13);
|
||||
g.FillPolygon(enginesColor, new Point[] //two down
|
||||
{
|
||||
new Point(_startPosX + 52, _startPosY + 80),
|
||||
new Point(_startPosX + 75, _startPosY + 80),
|
||||
new Point(_startPosX + 75, _startPosY + 90),
|
||||
new Point(_startPosX + 50, _startPosY + 90),
|
||||
}
|
||||
);
|
||||
g.FillEllipse(enginesColor, _startPosX + 71, _startPosY + 78, 13, 13);
|
||||
|
||||
if (amount == Engines.Four || amount == Engines.Six)
|
||||
{
|
||||
g.FillPolygon(enginesColor, new Point[] //four up
|
||||
{
|
||||
new Point(_startPosX + 48, _startPosY + 18),
|
||||
new Point(_startPosX + 75, _startPosY + 18),
|
||||
new Point(_startPosX + 75, _startPosY + 28),
|
||||
new Point(_startPosX + 50, _startPosY + 28),
|
||||
}
|
||||
);
|
||||
g.FillEllipse(enginesColor, _startPosX + 71, _startPosY + 16, 13, 13);
|
||||
g.FillPolygon(enginesColor, new Point[] //four down
|
||||
{
|
||||
new Point(_startPosX + 49, _startPosY + 92),
|
||||
new Point(_startPosX + 75, _startPosY + 92),
|
||||
new Point(_startPosX + 75, _startPosY + 102),
|
||||
new Point(_startPosX + 47, _startPosY + 102),
|
||||
}
|
||||
);
|
||||
g.FillEllipse(enginesColor, _startPosX + 71, _startPosY + 90, 13, 13);
|
||||
}
|
||||
if (amount == Engines.Six)
|
||||
{
|
||||
g.FillPolygon(enginesColor, new Point[] //six up
|
||||
{
|
||||
new Point(_startPosX + 46, _startPosY + 6),
|
||||
new Point(_startPosX + 75, _startPosY + 6),
|
||||
new Point(_startPosX + 75, _startPosY + 16),
|
||||
new Point(_startPosX + 48, _startPosY + 16),
|
||||
}
|
||||
);
|
||||
g.FillEllipse(enginesColor, _startPosX + 71, _startPosY + 4, 13, 13);
|
||||
g.FillPolygon(enginesColor, new Point[] //six down
|
||||
{
|
||||
new Point(_startPosX + 47, _startPosY + 104),
|
||||
new Point(_startPosX + 75, _startPosY + 104),
|
||||
new Point(_startPosX + 75, _startPosY + 114),
|
||||
new Point(_startPosX + 45, _startPosY + 114),
|
||||
}
|
||||
);
|
||||
g.FillEllipse(enginesColor, _startPosX + 71, _startPosY + 102, 13, 13);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
public class DrawningEnginesTriangle : IDrawningEngines
|
||||
{
|
||||
private Engines amount;
|
||||
public void SetAmount(int a)
|
||||
{
|
||||
if (a <= 2)
|
||||
{
|
||||
amount = Engines.Two;
|
||||
}
|
||||
else if (a == 4)
|
||||
{
|
||||
amount = Engines.Four;
|
||||
}
|
||||
else if (a >= 6)
|
||||
{
|
||||
amount = Engines.Six;
|
||||
}
|
||||
}
|
||||
public void DrawEngines(Graphics g, int _startPosX, int _startPosY)
|
||||
{
|
||||
Brush enginesColor = new SolidBrush(Color.Black);
|
||||
|
||||
g.FillPolygon(enginesColor, new Point[] //two up
|
||||
{
|
||||
new Point(_startPosX + 51, _startPosY + 30),
|
||||
new Point(_startPosX + 75, _startPosY + 30),
|
||||
new Point(_startPosX + 75, _startPosY + 40),
|
||||
new Point(_startPosX + 53, _startPosY + 40),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //two up TRIANGLE SHAPE
|
||||
{
|
||||
new Point(_startPosX + 73, _startPosY + 33),
|
||||
new Point(_startPosX + 80, _startPosY + 28),
|
||||
new Point(_startPosX + 80, _startPosY + 41),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //two down
|
||||
{
|
||||
new Point(_startPosX + 52, _startPosY + 80),
|
||||
new Point(_startPosX + 75, _startPosY + 80),
|
||||
new Point(_startPosX + 75, _startPosY + 90),
|
||||
new Point(_startPosX + 50, _startPosY + 90),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //two down TRIANGLE SHAPE
|
||||
{
|
||||
new Point(_startPosX + 73, _startPosY + 83),
|
||||
new Point(_startPosX + 80, _startPosY + 78),
|
||||
new Point(_startPosX + 80, _startPosY + 91),
|
||||
}
|
||||
);
|
||||
|
||||
if (amount == Engines.Four || amount == Engines.Six)
|
||||
{
|
||||
g.FillPolygon(enginesColor, new Point[] //four up
|
||||
{
|
||||
new Point(_startPosX + 48, _startPosY + 18),
|
||||
new Point(_startPosX + 75, _startPosY + 18),
|
||||
new Point(_startPosX + 75, _startPosY + 28),
|
||||
new Point(_startPosX + 50, _startPosY + 28),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //four up TRIANGLE SHAPE
|
||||
{
|
||||
new Point(_startPosX + 73, _startPosY + 23),
|
||||
new Point(_startPosX + 80, _startPosY + 16),
|
||||
new Point(_startPosX + 80, _startPosY + 27),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //four down
|
||||
{
|
||||
new Point(_startPosX + 49, _startPosY + 92),
|
||||
new Point(_startPosX + 75, _startPosY + 92),
|
||||
new Point(_startPosX + 75, _startPosY + 102),
|
||||
new Point(_startPosX + 47, _startPosY + 102),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //four down TRIANGLE SHAPE
|
||||
{
|
||||
new Point(_startPosX + 73, _startPosY + 97),
|
||||
new Point(_startPosX + 80, _startPosY + 92),
|
||||
new Point(_startPosX + 80, _startPosY + 105),
|
||||
}
|
||||
);
|
||||
}
|
||||
if (amount == Engines.Six)
|
||||
{
|
||||
g.FillPolygon(enginesColor, new Point[] //six up
|
||||
{
|
||||
new Point(_startPosX + 46, _startPosY + 6),
|
||||
new Point(_startPosX + 75, _startPosY + 6),
|
||||
new Point(_startPosX + 75, _startPosY + 16),
|
||||
new Point(_startPosX + 48, _startPosY + 16),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //six up TRIANGLE SHAPE
|
||||
{
|
||||
new Point(_startPosX + 73, _startPosY + 11),
|
||||
new Point(_startPosX + 80, _startPosY + 5),
|
||||
new Point(_startPosX + 80, _startPosY + 17),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //six down
|
||||
{
|
||||
new Point(_startPosX + 47, _startPosY + 104),
|
||||
new Point(_startPosX + 75, _startPosY + 104),
|
||||
new Point(_startPosX + 75, _startPosY + 114),
|
||||
new Point(_startPosX + 45, _startPosY + 114),
|
||||
}
|
||||
);
|
||||
g.FillPolygon(enginesColor, new Point[] //six down TRIANGLE SHAPE
|
||||
{
|
||||
new Point(_startPosX + 73, _startPosY + 109),
|
||||
new Point(_startPosX + 80, _startPosY + 103),
|
||||
new Point(_startPosX + 80, _startPosY + 115),
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -19,28 +19,28 @@ namespace AirBomber
|
||||
_drawningAirPlane.DrawPlane(gr);
|
||||
pictureBoxAirBomber.Image = bmp;
|
||||
}
|
||||
private void buttonCreateAirBomber_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirPlane = new DrawningAirBomber(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxAirBomber.Width, pictureBoxAirBomber.Height, random.Next(1, 4) * 2, random.Next(1, 3));
|
||||
|
||||
_drawningAirPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
|
||||
}
|
||||
private void buttonCreateAirPlane_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirPlane = new DrawningAirPlane(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
pictureBoxAirBomber.Width, pictureBoxAirBomber.Height, random.Next(1, 4) * 2, random.Next(1, 3));
|
||||
pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
|
||||
|
||||
_drawningAirPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonCreateAirBomber_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new();
|
||||
_drawningAirPlane = new DrawningAirBomber(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxAirBomber.Width, pictureBoxAirBomber.Height);
|
||||
|
||||
_drawningAirPlane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
|
||||
}
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAirPlane == null)
|
||||
@ -65,6 +65,7 @@ namespace AirBomber
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void buttonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningAirPlane == null)
|
||||
|
@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal interface IDrawningEngines
|
||||
{
|
||||
public void SetAmount(int a);
|
||||
public void DrawEngines(Graphics g, int _startPosX, int _startPosY);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user