This commit is contained in:
Yuee Shiness 2022-10-03 16:43:54 +04:00
commit e362903c4d
7 changed files with 2 additions and 37 deletions

View File

@ -37,16 +37,12 @@ namespace AirFighter
{
int CollisionFlag = 0;
Size objSize1 = new Size(100,100);
//COLLISION CHECK
if (direction == Direction.Up)
{
for (int i = 0; i < _map.GetLength(0); i++)
{
for (int j = 0; j < _map.GetLength(1); j++)
@ -123,12 +119,7 @@ namespace AirFighter
{
Point LeftTop = new Point((int)(_drawingObject.GetCurrentPosition().Left + _drawingObject.Step), (int)_drawingObject.GetCurrentPosition().Top);
Rectangle objectRect = new Rectangle(LeftTop, objSize1);
Rectangle rectBarrier = new Rectangle((int)(i * _size_x), (int)(j * _size_y), (int)_size_x, (int)_size_y);
if (objectRect.IntersectsWith(rectBarrier))
{
CollisionFlag = 1;
@ -175,11 +166,8 @@ namespace AirFighter
}
}
}
}
return true;
}
private Bitmap DrawMapWithObject()
@ -208,14 +196,11 @@ namespace AirFighter
return bmp;
}
protected abstract void GenerateMap();
protected abstract void DrawRoadPart(Graphics g, int i, int j);
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
}
}

View File

@ -19,7 +19,6 @@ namespace AirFighter
pictureBoxAirFighter.Image = bmp;
}
private void SetData()
{
Random rnd = new Random();
@ -30,8 +29,6 @@ namespace AirFighter
toolStripStatusBodyColor.Text = $"BodyColor: {_aircraft.Plane.BodyColor.Name}";
}
private void buttonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();

View File

@ -140,8 +140,6 @@ namespace AirFighter
return;
}
//Aircraft Body
Pen pen = new(Color.Black);
Brush brWhite = new SolidBrush(Plane.BodyColor);
@ -150,7 +148,6 @@ namespace AirFighter
g.DrawRectangle(pen,_startPosX + 20, _startPosY + 45, 80, 14);
//Wings
GraphicsPath pathWing1 = new GraphicsPath();
Point point1B = new Point((int)(_startPosX + 50), (int)(_startPosY + 45));
@ -163,7 +160,6 @@ namespace AirFighter
g.DrawPath(pen, pathWing1);
g.FillPath(brWhite, pathWing1);
GraphicsPath pathWing2 = new GraphicsPath();
Point point1B2 = new Point((int)(_startPosX + 50), (int)(_startPosY + 60));

View File

@ -26,9 +26,6 @@ namespace AirFighter
base.DrawTransport(g);
if (militaryAircraft.ExtraWings)
{
GraphicsPath pathExtraWing1 = new GraphicsPath();
@ -57,8 +54,6 @@ namespace AirFighter
}
if (militaryAircraft.Rockets)
{
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 30,17,4);
@ -87,10 +82,6 @@ namespace AirFighter
pathRocketHead2.AddLines(pointsExtraRocketHead2);
g.DrawPath(pen, pathRocketHead2);
g.FillPath(extraBrush, pathRocketHead2);
}
}

View File

@ -28,8 +28,7 @@ namespace AirFighter
//=> оператор подобный return
public float Step => Speed * 100 / Weight;
public EntityAircraft(int speed, float weight, Color bodyColor)
{
Speed = speed;

View File

@ -10,12 +10,10 @@ namespace AirFighter
{
public Color ExtraColor { get; private set; }
public bool Rockets { get; private set; }
public bool ExtraWings { get; private set; }
public EntityMilitaryAircraft(int speed, float weight, Color bodyColor, Color extraColor, bool rockets, bool extraWings) : base(speed, weight, bodyColor)
{
ExtraColor = extraColor;

View File

@ -28,7 +28,6 @@ namespace AirFighter
{
int emptypos = -1;
if (position >= Count && position < 0)
{
return -1;