Исправление неточностей
This commit is contained in:
parent
468f859fe0
commit
61de90a13a
@ -37,9 +37,9 @@ namespace Stormtrooper
|
|||||||
/// Высота отрисовки самолёта
|
/// Высота отрисовки самолёта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly int _airplaneHeight;
|
protected readonly int _airplaneHeight;
|
||||||
public DrawningMilitaryAirplane(int speed, int weight, int wight = 80, int height = 100)
|
public DrawningMilitaryAirplane(int speed, int weight,Color color, int wight = 80, int height = 100)
|
||||||
{
|
{
|
||||||
Airplane = new EntityMilitaryAirplane(speed, weight);
|
Airplane = new EntityMilitaryAirplane(speed, weight, color);
|
||||||
_airplaneWidth = wight;
|
_airplaneWidth = wight;
|
||||||
_airplaneHeight = height;
|
_airplaneHeight = height;
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ namespace Stormtrooper
|
|||||||
Pen pen = new Pen(Color.Black);
|
Pen pen = new Pen(Color.Black);
|
||||||
|
|
||||||
|
|
||||||
Brush brush = new SolidBrush(Color.DarkGreen);
|
Brush brush = new SolidBrush(Airplane.Color);
|
||||||
g.FillPolygon(brush, new PointF[3] {new PointF(_startPosX, _startPosY + _airplaneHeight / 2),
|
g.FillPolygon(brush, new PointF[3] {new PointF(_startPosX, _startPosY + _airplaneHeight / 2),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f),
|
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.45f),
|
||||||
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.55f)});
|
new PointF(_startPosX + _airplaneWidth * 0.1f, _startPosY + _airplaneHeight * 0.55f)});
|
||||||
|
@ -8,9 +8,9 @@ namespace Stormtrooper
|
|||||||
{
|
{
|
||||||
internal class DrawningStormtrooper : DrawningMilitaryAirplane
|
internal class DrawningStormtrooper : DrawningMilitaryAirplane
|
||||||
{
|
{
|
||||||
public DrawningStormtrooper(int speed, int weight, int crew, Color advColor, bool rockets, bool boosters, bool radar) : base(speed, weight)
|
public DrawningStormtrooper(int speed, int weight, Color color, Color advColor, bool rockets, bool boosters, bool radar) : base(speed, weight, color)
|
||||||
{
|
{
|
||||||
Airplane = new EntityStormtrooper(speed, weight,crew, advColor, rockets, boosters, radar);
|
Airplane = new EntityStormtrooper(speed, weight,color, advColor, rockets, boosters, radar);
|
||||||
}
|
}
|
||||||
public override void DrawAirplane(Graphics g)
|
public override void DrawAirplane(Graphics g)
|
||||||
{
|
{
|
||||||
|
@ -10,16 +10,16 @@ namespace Stormtrooper
|
|||||||
{
|
{
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
public int Weight { get; private set; }
|
public int Weight { get; private set; }
|
||||||
public int Crew { get; private set; }
|
public Color Color { get; private set; }
|
||||||
|
|
||||||
public float Step => Speed * 25 / Weight;
|
public float Step => Speed * 25 / Weight;
|
||||||
|
|
||||||
public EntityMilitaryAirplane(int speed, int weight, int crew = 10)
|
public EntityMilitaryAirplane(int speed, int weight, Color color)
|
||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Speed = speed <= 0 ? random.Next(10, 100) : speed;
|
Speed = speed <= 0 ? random.Next(10, 100) : speed;
|
||||||
Weight = weight <= 0 ? random.Next(50, 150) : weight;
|
Weight = weight <= 0 ? random.Next(50, 150) : weight;
|
||||||
Crew = crew;
|
Color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ namespace Stormtrooper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Radar { get; private set; }
|
public bool Radar { get; private set; }
|
||||||
|
|
||||||
public EntityStormtrooper(int speed, int weight, int crew, Color advColor, bool rockets, bool boosters, bool radar)
|
public EntityStormtrooper(int speed, int weight, Color color, Color advColor, bool rockets, bool boosters, bool radar)
|
||||||
: base(speed, weight, crew)
|
: base(speed, weight, color)
|
||||||
{
|
{
|
||||||
Rockets = rockets;
|
Rockets = rockets;
|
||||||
Booster = boosters;
|
Booster = boosters;
|
||||||
|
@ -22,7 +22,7 @@ namespace Stormtrooper
|
|||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
_airplane = new DrawningMilitaryAirplane(10, 50);
|
_airplane = new DrawningMilitaryAirplane(10, 50, Color.DarkGreen);
|
||||||
_airplane.SetPosition(random.Next(100,150), random.Next(100,150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
_airplane.SetPosition(random.Next(100,150), random.Next(100,150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||||
SetData();
|
SetData();
|
||||||
}
|
}
|
||||||
@ -53,7 +53,6 @@ namespace Stormtrooper
|
|||||||
{
|
{
|
||||||
toolStripLabelSpeed.Text = $"Скорость: {_airplane.Airplane.Speed}";
|
toolStripLabelSpeed.Text = $"Скорость: {_airplane.Airplane.Speed}";
|
||||||
toolStripLabelWeight.Text = $"Вес: {_airplane.Airplane.Weight}";
|
toolStripLabelWeight.Text = $"Вес: {_airplane.Airplane.Weight}";
|
||||||
toolStripLabelCrew.Text = $"Экипаж: {_airplane.Airplane.Crew}";
|
|
||||||
pictureBoxAirplane.Image = _abstractMap.CreateMap(pictureBoxAirplane.Width, pictureBoxAirplane.Height,
|
pictureBoxAirplane.Image = _abstractMap.CreateMap(pictureBoxAirplane.Width, pictureBoxAirplane.Height,
|
||||||
new DrawningObject(_airplane));
|
new DrawningObject(_airplane));
|
||||||
}
|
}
|
||||||
@ -62,7 +61,7 @@ namespace Stormtrooper
|
|||||||
{
|
{
|
||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
_airplane = new DrawningStormtrooper(random.Next(10,100),random.Next(50,250),random.Next(1,100),
|
_airplane = new DrawningStormtrooper(random.Next(10,100),random.Next(50,250), 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)),
|
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)), Convert.ToBoolean(random.Next(0, 2)));
|
Convert.ToBoolean(random.Next(0,2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
_airplane.SetPosition(random.Next(100, 150), random.Next(100, 150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
_airplane.SetPosition(random.Next(100, 150), random.Next(100, 150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||||
|
@ -29,10 +29,15 @@ namespace Stormtrooper
|
|||||||
}
|
}
|
||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rnd = new Random();
|
Random random = new Random();
|
||||||
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
_airplane = new DrawningMilitaryAirplane(10, 50);
|
ColorDialog dialog = new();
|
||||||
_airplane.SetPosition(rnd.Next(100,150), rnd.Next(100,150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
color = dialog.Color;
|
||||||
|
}
|
||||||
|
_airplane = new DrawningMilitaryAirplane(10, 50, color);
|
||||||
|
_airplane.SetPosition(random.Next(100,150), random.Next(100,150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||||
SetData();
|
SetData();
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
@ -68,7 +73,6 @@ namespace Stormtrooper
|
|||||||
{
|
{
|
||||||
toolStripLabelSpeed.Text = $"Скорость: {_airplane.Airplane.Speed}";
|
toolStripLabelSpeed.Text = $"Скорость: {_airplane.Airplane.Speed}";
|
||||||
toolStripLabelWeight.Text = $"Вес: {_airplane.Airplane.Weight}";
|
toolStripLabelWeight.Text = $"Вес: {_airplane.Airplane.Weight}";
|
||||||
toolStripLabelCrew.Text = $"Экипаж: {_airplane.Airplane.Crew}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCreateMod_Click(object sender, EventArgs e)
|
private void buttonCreateMod_Click(object sender, EventArgs e)
|
||||||
@ -76,12 +80,17 @@ namespace Stormtrooper
|
|||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
Color color = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
|
Color advColor = Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256));
|
||||||
ColorDialog dialog = new();
|
ColorDialog dialog = new();
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
color = dialog.Color;
|
color = dialog.Color;
|
||||||
}
|
}
|
||||||
_airplane = new DrawningStormtrooper(random.Next(10,100),random.Next(50,250),random.Next(1,100),
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
advColor = dialog.Color;
|
||||||
|
}
|
||||||
|
_airplane = new DrawningStormtrooper(random.Next(10,100),random.Next(50,250),advColor,
|
||||||
color,
|
color,
|
||||||
Convert.ToBoolean(random.Next(0,2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
Convert.ToBoolean(random.Next(0,2)), Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||||
_airplane.SetPosition(random.Next(100, 150), random.Next(100, 150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
_airplane.SetPosition(random.Next(100, 150), random.Next(100, 150), pictureBoxAirplane.Width, pictureBoxAirplane.Height);
|
||||||
|
Loading…
Reference in New Issue
Block a user