over
This commit is contained in:
parent
5c64922ef4
commit
874e2f1c63
@ -33,11 +33,11 @@ public class DrawningAiroplane
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ширина прорисовки
|
/// Ширина прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningAiroplaneWidth = 180;
|
private readonly int _drawningAiroplaneWidth = 160;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Высота прорисовки
|
/// Высота прорисовки
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _drawningaAiroplaneHeight = 110;
|
private readonly int _drawningaAiroplaneHeight = 80;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Инициализация свойств
|
/// Инициализация свойств
|
||||||
@ -48,12 +48,12 @@ public class DrawningAiroplane
|
|||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="toplivbak">Признак наличия бака</param>
|
/// <param name="toplivbak">Признак наличия бака</param>
|
||||||
/// <param name="radar">Признак наличия радара</param>
|
/// <param name="radar">Признак наличия радара</param>
|
||||||
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
public void Init(int speed, double weight, Color bodyColor, Color
|
||||||
additionalColor, bool toplivbak, bool radar, bool sportLine)
|
additionalColor, bool toplivbak, bool radar)
|
||||||
{
|
{
|
||||||
EntityAiroplane = new EntityAiroplane();
|
EntityAiroplane = new EntityAiroplane();
|
||||||
EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, toplivbak, radar, sportLine);
|
EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, toplivbak, radar);
|
||||||
_pictureWidth = null;
|
_pictureWidth = null;
|
||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
_startPosX = null;
|
_startPosX = null;
|
||||||
@ -78,21 +78,20 @@ public bool SetPictureSize(int width, int height)
|
|||||||
|
|
||||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||||
{
|
{
|
||||||
if (_startPosX + _drawningAiroplaneWidth <= _pictureWidth)
|
if (_startPosX + _drawningAiroplaneWidth > _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosX = 0;
|
_startPosX = _pictureWidth - _drawningAiroplaneWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_startPosY + _drawningaAiroplaneHeight <= _pictureWidth)
|
if (_startPosY + _drawningaAiroplaneHeight > _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosY = 0;
|
_startPosY = _pictureHeight - _drawningaAiroplaneHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка позиции
|
/// Установка позиции
|
||||||
@ -194,65 +193,57 @@ public bool MoveTransport(DirectionType direction)
|
|||||||
SolidBrush(EntityAiroplane.AdditionalColor);
|
SolidBrush(EntityAiroplane.AdditionalColor);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////
|
//////
|
||||||
//крыло верхнее самолета
|
//крыло верхнее самолета
|
||||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 30, _startPosX.Value + 30, _startPosY.Value + 60);
|
g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 5, _startPosX.Value + 15, _startPosY.Value + 5);
|
||||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 30, _startPosX.Value + 70, _startPosY.Value + 60);
|
g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 5, _startPosX.Value + 55, _startPosY.Value + 35);
|
||||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 60, _startPosX.Value + 70, _startPosY.Value + 60);
|
g.DrawLine(pen, _startPosX.Value + 15, _startPosY.Value + 35, _startPosX.Value + 15, _startPosY.Value + 5);
|
||||||
|
|
||||||
//задняя часть самолета полукруг
|
//задняя часть самолета полукруг
|
||||||
g.DrawArc(pen, _startPosX.Value + 20, _startPosY.Value + 60, 30,30,90,180);
|
g.DrawArc(pen, _startPosX.Value + 5, _startPosY.Value + 35, 30,30,90,180);
|
||||||
|
|
||||||
//сзади
|
//сзади
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 55, 40,10);
|
g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 30, 40,10);
|
||||||
Brush brbr = new SolidBrush(Color.Brown);
|
Brush brbr = new SolidBrush(Color.Brown);
|
||||||
g.FillEllipse(brbr, _startPosX.Value + 25, _startPosY.Value + 55, 40,10);
|
g.FillEllipse(brbr, _startPosX.Value + 10, _startPosY.Value + 30, 40,10);
|
||||||
//низ самолета
|
//низ самолета
|
||||||
g.DrawLine(pen, _startPosX.Value + 31, _startPosY.Value + 90, _startPosX.Value + 150, _startPosY.Value + 90);
|
g.DrawLine(pen, _startPosX.Value + 16, _startPosY.Value + 65, _startPosX.Value + 135, _startPosY.Value + 65);
|
||||||
|
|
||||||
|
|
||||||
// треуголник спереди
|
// треуголник спереди
|
||||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 93, _startPosX.Value + 150, _startPosY.Value + 57);
|
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 68, _startPosX.Value + 135, _startPosY.Value + 32);
|
||||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 57, _startPosX.Value + 175, _startPosY.Value + 75);
|
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 32, _startPosX.Value + 160, _startPosY.Value + 50);
|
||||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 93, _startPosX.Value + 175, _startPosY.Value + 75);
|
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 68, _startPosX.Value + 160, _startPosY.Value + 50);
|
||||||
g.DrawLine(pen, _startPosX.Value + 150, _startPosY.Value + 75, _startPosX.Value + 175, _startPosY.Value + 75);
|
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 50, _startPosX.Value + 160, _startPosY.Value + 50);
|
||||||
|
|
||||||
//вверх от тругольника до треугольника
|
//вверх от тругольника до треугольника
|
||||||
g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 60, _startPosX.Value + 150, _startPosY.Value + 60);
|
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 35, _startPosX.Value + 135, _startPosY.Value + 35);
|
||||||
|
|
||||||
//крыло
|
//крыло
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 45, 70, 10);
|
||||||
Brush brbl = new SolidBrush(Color.Black);
|
Brush brbl = new SolidBrush(Color.Black);
|
||||||
g.FillEllipse(brbl, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10);
|
g.FillEllipse(brbl, _startPosX.Value + 50, _startPosY.Value + 45, 70, 10);
|
||||||
|
|
||||||
//шасси
|
//шасси
|
||||||
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 90, _startPosX.Value + 50, _startPosY.Value + 100);
|
g.DrawLine(pen, _startPosX.Value + 35, _startPosY.Value + 65, _startPosX.Value + 35, _startPosY.Value + 75);
|
||||||
g.DrawLine(pen, _startPosX.Value + 135, _startPosY.Value + 90, _startPosX.Value + 135, _startPosY.Value + 100);
|
g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 65, _startPosX.Value + 120, _startPosY.Value + 75);
|
||||||
g.DrawLine(pen, _startPosX.Value + 40, _startPosY.Value + 100, _startPosX.Value + 60, _startPosY.Value + 100);
|
g.DrawLine(pen, _startPosX.Value + 25, _startPosY.Value + 75, _startPosX.Value + 45, _startPosY.Value + 75);
|
||||||
|
g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 70, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 95, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 45, _startPosY.Value + 70, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 60, _startPosY.Value + 95, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 115, _startPosY.Value + 70, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 130, _startPosY.Value + 95, 10, 10);
|
|
||||||
|
|
||||||
//топливный бак
|
//топливный бак
|
||||||
if (EntityAiroplane.Toplivbak)
|
if (EntityAiroplane.Toplivbak)
|
||||||
{
|
{
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 80,_startPosY.Value + 45, 30, 15);
|
g.FillRectangle(additionalBrush, _startPosX.Value + 65,_startPosY.Value + 20, 30, 15);
|
||||||
//g.FillRectangle(additionalBrush, _startPosX.Value + 35,_startPosY.Value + 23, 35, 15);
|
|
||||||
//g.FillRectangle(additionalBrush, _startPosX.Value + 10,_startPosY.Value + 23, 20, 15);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Радар
|
//Радар
|
||||||
if (EntityAiroplane.Radar)
|
if (EntityAiroplane.Radar)
|
||||||
{
|
{
|
||||||
Brush brGreen = new SolidBrush(Color.LightGreen);
|
Brush brGreen = new SolidBrush(Color.LightGreen);
|
||||||
g.FillEllipse(brGreen, _startPosX.Value + 150, _startPosY.Value + 75, 10, 10);
|
g.FillEllipse(brGreen, _startPosX.Value + 135, _startPosY.Value + 50, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 150, _startPosY.Value + 75, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 135, _startPosY.Value + 50, 10, 10);
|
||||||
}
|
|
||||||
|
|
||||||
//спортивная линия
|
|
||||||
if (EntityAiroplane.SportLine) {
|
|
||||||
g.FillRectangle(additionalBrush, _startPosX.Value + 138, _startPosY.Value + 60, 10, 30);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
namespace ProjectAiroplane;
|
namespace ProjectAiroplane;
|
||||||
|
|
||||||
public class EntityAiroplane
|
public class EntityAiroplane
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Скорость
|
/// Скорость
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Вес
|
/// Вес
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,11 +26,7 @@ public class EntityAiroplane
|
|||||||
// </summary>
|
// </summary>
|
||||||
public bool Radar { get; private set; }
|
public bool Radar { get; private set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Признак (опция) наличия гоночной полосы
|
/// Шаг перемещения самолета
|
||||||
/// </summary>
|
|
||||||
public bool SportLine { get; private set; }
|
|
||||||
/// <summary>
|
|
||||||
/// Шаг перемещения автомобиля
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Step => Speed * 100 / Weight;
|
public double Step => Speed * 100 / Weight;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -43,8 +38,8 @@ public class EntityAiroplane
|
|||||||
/// <param name="additionalColor"></Дополнительный цвет>
|
/// <param name="additionalColor"></Дополнительный цвет>
|
||||||
/// <param name="toplivbak"></ Признак наличия бака>
|
/// <param name="toplivbak"></ Признак наличия бака>
|
||||||
/// <param name="radar"></Признак (опция) наличия радара>
|
/// <param name="radar"></Признак (опция) наличия радара>
|
||||||
/// <param name="sportLine"></Признак (опция) наличия гоночной полосы>
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar, bool sportLine)
|
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar)
|
||||||
{
|
{
|
||||||
Speed = speed;
|
Speed = speed;
|
||||||
Weight = weight;
|
Weight = weight;
|
||||||
@ -52,7 +47,6 @@ public class EntityAiroplane
|
|||||||
AdditionalColor = additionalColor;
|
AdditionalColor = additionalColor;
|
||||||
Toplivbak = toplivbak;
|
Toplivbak = toplivbak;
|
||||||
Radar = radar;
|
Radar = radar;
|
||||||
SportLine = sportLine;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,7 @@ public partial class FormAiroplane : Form
|
|||||||
_drawningAiroplane.Init(random.Next(100, 300), random.Next(1000, 3000),
|
_drawningAiroplane.Init(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)),
|
||||||
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)));
|
|
||||||
_drawningAiroplane.SetPictureSize(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height);
|
_drawningAiroplane.SetPictureSize(pictureBoxAiroplane.Width, pictureBoxAiroplane.Height);
|
||||||
_drawningAiroplane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
_drawningAiroplane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user