Merge branch 'LabWork03' of http://student.git.athene.tech/1yuee/PIbd-23_Lisov_N.A._AirFighter._Base into LabWork03
This commit is contained in:
commit
e362903c4d
@ -37,16 +37,12 @@ namespace AirFighter
|
|||||||
{
|
{
|
||||||
int CollisionFlag = 0;
|
int CollisionFlag = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Size objSize1 = new Size(100,100);
|
Size objSize1 = new Size(100,100);
|
||||||
|
|
||||||
//COLLISION CHECK
|
//COLLISION CHECK
|
||||||
if (direction == Direction.Up)
|
if (direction == Direction.Up)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < _map.GetLength(0); i++)
|
for (int i = 0; i < _map.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < _map.GetLength(1); j++)
|
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);
|
Point LeftTop = new Point((int)(_drawingObject.GetCurrentPosition().Left + _drawingObject.Step), (int)_drawingObject.GetCurrentPosition().Top);
|
||||||
Rectangle objectRect = new Rectangle(LeftTop, objSize1);
|
Rectangle objectRect = new Rectangle(LeftTop, objSize1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Rectangle rectBarrier = new Rectangle((int)(i * _size_x), (int)(j * _size_y), (int)_size_x, (int)_size_y);
|
Rectangle rectBarrier = new Rectangle((int)(i * _size_x), (int)(j * _size_y), (int)_size_x, (int)_size_y);
|
||||||
|
|
||||||
|
|
||||||
if (objectRect.IntersectsWith(rectBarrier))
|
if (objectRect.IntersectsWith(rectBarrier))
|
||||||
{
|
{
|
||||||
CollisionFlag = 1;
|
CollisionFlag = 1;
|
||||||
@ -175,11 +166,8 @@ namespace AirFighter
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bitmap DrawMapWithObject()
|
private Bitmap DrawMapWithObject()
|
||||||
@ -208,14 +196,11 @@ namespace AirFighter
|
|||||||
return bmp;
|
return bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected abstract void GenerateMap();
|
protected abstract void GenerateMap();
|
||||||
|
|
||||||
protected abstract void DrawRoadPart(Graphics g, int i, int j);
|
protected abstract void DrawRoadPart(Graphics g, int i, int j);
|
||||||
|
|
||||||
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
|
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ namespace AirFighter
|
|||||||
pictureBoxAirFighter.Image = bmp;
|
pictureBoxAirFighter.Image = bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SetData()
|
private void SetData()
|
||||||
{
|
{
|
||||||
Random rnd = new Random();
|
Random rnd = new Random();
|
||||||
@ -30,8 +29,6 @@ namespace AirFighter
|
|||||||
toolStripStatusBodyColor.Text = $"BodyColor: {_aircraft.Plane.BodyColor.Name}";
|
toolStripStatusBodyColor.Text = $"BodyColor: {_aircraft.Plane.BodyColor.Name}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
|
@ -140,8 +140,6 @@ namespace AirFighter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Aircraft Body
|
//Aircraft Body
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
Brush brWhite = new SolidBrush(Plane.BodyColor);
|
Brush brWhite = new SolidBrush(Plane.BodyColor);
|
||||||
@ -150,7 +148,6 @@ namespace AirFighter
|
|||||||
g.DrawRectangle(pen,_startPosX + 20, _startPosY + 45, 80, 14);
|
g.DrawRectangle(pen,_startPosX + 20, _startPosY + 45, 80, 14);
|
||||||
|
|
||||||
//Wings
|
//Wings
|
||||||
|
|
||||||
GraphicsPath pathWing1 = new GraphicsPath();
|
GraphicsPath pathWing1 = new GraphicsPath();
|
||||||
|
|
||||||
Point point1B = new Point((int)(_startPosX + 50), (int)(_startPosY + 45));
|
Point point1B = new Point((int)(_startPosX + 50), (int)(_startPosY + 45));
|
||||||
@ -163,7 +160,6 @@ namespace AirFighter
|
|||||||
g.DrawPath(pen, pathWing1);
|
g.DrawPath(pen, pathWing1);
|
||||||
g.FillPath(brWhite, pathWing1);
|
g.FillPath(brWhite, pathWing1);
|
||||||
|
|
||||||
|
|
||||||
GraphicsPath pathWing2 = new GraphicsPath();
|
GraphicsPath pathWing2 = new GraphicsPath();
|
||||||
|
|
||||||
Point point1B2 = new Point((int)(_startPosX + 50), (int)(_startPosY + 60));
|
Point point1B2 = new Point((int)(_startPosX + 50), (int)(_startPosY + 60));
|
||||||
|
@ -26,9 +26,6 @@ namespace AirFighter
|
|||||||
|
|
||||||
base.DrawTransport(g);
|
base.DrawTransport(g);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (militaryAircraft.ExtraWings)
|
if (militaryAircraft.ExtraWings)
|
||||||
{
|
{
|
||||||
GraphicsPath pathExtraWing1 = new GraphicsPath();
|
GraphicsPath pathExtraWing1 = new GraphicsPath();
|
||||||
@ -57,8 +54,6 @@ namespace AirFighter
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (militaryAircraft.Rockets)
|
if (militaryAircraft.Rockets)
|
||||||
{
|
{
|
||||||
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 30,17,4);
|
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 30,17,4);
|
||||||
@ -87,10 +82,6 @@ namespace AirFighter
|
|||||||
pathRocketHead2.AddLines(pointsExtraRocketHead2);
|
pathRocketHead2.AddLines(pointsExtraRocketHead2);
|
||||||
g.DrawPath(pen, pathRocketHead2);
|
g.DrawPath(pen, pathRocketHead2);
|
||||||
g.FillPath(extraBrush, pathRocketHead2);
|
g.FillPath(extraBrush, pathRocketHead2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@ namespace AirFighter
|
|||||||
|
|
||||||
//=> оператор подобный return
|
//=> оператор подобный return
|
||||||
public float Step => Speed * 100 / Weight;
|
public float Step => Speed * 100 / Weight;
|
||||||
|
|
||||||
|
|
||||||
public EntityAircraft(int speed, float weight, Color bodyColor)
|
public EntityAircraft(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
Speed = speed;
|
||||||
|
@ -10,12 +10,10 @@ namespace AirFighter
|
|||||||
{
|
{
|
||||||
public Color ExtraColor { get; private set; }
|
public Color ExtraColor { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public bool Rockets { get; private set; }
|
public bool Rockets { get; private set; }
|
||||||
|
|
||||||
public bool ExtraWings { 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)
|
public EntityMilitaryAircraft(int speed, float weight, Color bodyColor, Color extraColor, bool rockets, bool extraWings) : base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
ExtraColor = extraColor;
|
ExtraColor = extraColor;
|
||||||
|
@ -28,7 +28,6 @@ namespace AirFighter
|
|||||||
{
|
{
|
||||||
int emptypos = -1;
|
int emptypos = -1;
|
||||||
|
|
||||||
|
|
||||||
if (position >= Count && position < 0)
|
if (position >= Count && position < 0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user