финальные изменения
This commit is contained in:
parent
09aba1c075
commit
669f8b4568
@ -11,26 +11,20 @@ namespace AirBomber
|
||||
{
|
||||
public EntityAirBomber? EntityAirBomber { get; private set; }
|
||||
|
||||
private int _pictureWeigth;
|
||||
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
|
||||
private int _startPosX;
|
||||
|
||||
private int _startPosY;
|
||||
|
||||
private int _PlaneWidth = 160;
|
||||
|
||||
private int _PlaneHeight = 185;
|
||||
|
||||
public bool Init(int speed, int weight, Color bodycolor, Color dopcolor, bool toplivo, bool rocket, int width, int height)
|
||||
{
|
||||
//TODO: Продумать проверки
|
||||
if (width < _pictureWeigth || height < _pictureHeight)
|
||||
if (width < _pictureWidth || height < _pictureHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_pictureWeigth = width;
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityAirBomber = new EntityAirBomber();
|
||||
EntityAirBomber.Init(speed, weight, bodycolor, dopcolor, toplivo, rocket);
|
||||
@ -39,13 +33,16 @@ namespace AirBomber
|
||||
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
|
||||
//TODO: Изменения x, y
|
||||
if (x <= _pictureWeigth - _PlaneWidth && x >= 0 && y <= _pictureHeight - _PlaneHeight && y >= 0)
|
||||
if (x < 0 || x + _PlaneWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
x = _pictureWidth - _PlaneWidth;
|
||||
}
|
||||
if (y < 0 || y + _PlaneWidth > _pictureHeight)
|
||||
{
|
||||
y = _pictureHeight - _PlaneWidth;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
|
||||
public void MoveTransport(Diraction diraction)
|
||||
@ -70,13 +67,13 @@ namespace AirBomber
|
||||
}
|
||||
break;
|
||||
case Diraction.Right:
|
||||
if (_startPosX + step + _PlaneWidth <= _pictureWeigth)
|
||||
if (_startPosX + step + _PlaneWidth <= _pictureWidth)
|
||||
{
|
||||
_startPosX += step;
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = _pictureWeigth - _PlaneWidth;
|
||||
_startPosX = _pictureWidth - _PlaneWidth;
|
||||
}
|
||||
break;
|
||||
case Diraction.Up:
|
||||
@ -102,7 +99,6 @@ namespace AirBomber
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void DrawCar(Graphics g)
|
||||
{
|
||||
if (EntityAirBomber == null)
|
||||
@ -149,8 +145,6 @@ namespace AirBomber
|
||||
g.FillRectangle(dopcolor, _startPosX + 82, _startPosY + 150, 8, 10);
|
||||
g.FillRectangle(dopcolor, _startPosX + 82, _startPosY + 170, 8, 10);
|
||||
}
|
||||
//g.DrawEllipse(pen, _startPosX + 90, _startPosY, 20, 20);
|
||||
//g.DrawRectangle(pen, _startPosX + 90, _startPosY + 10,20, 40);
|
||||
//отрисовка крыла 1
|
||||
GraphicsPath fly_1 = new GraphicsPath();
|
||||
fly_1.AddLine(_startPosX + 80, _startPosY + 2, _startPosX + 80, _startPosY + 80);
|
||||
@ -176,7 +170,6 @@ namespace AirBomber
|
||||
g.DrawPath(Pens.Black, fly_2);
|
||||
//отриосвка хвоста
|
||||
GraphicsPath wing = new GraphicsPath();
|
||||
//wing.AddLine(_startPosX, _startPosY, _startPosX, _startPosY);
|
||||
wing.AddLine(_startPosX + 135, _startPosY + 80, _startPosX + 135, _startPosY + 70);
|
||||
wing.AddLine(_startPosX + 135, _startPosY + 70, _startPosX + 150, _startPosY + 50);
|
||||
wing.AddLine(_startPosX + 150, _startPosY + 50, _startPosX + 150, _startPosY + 80);
|
||||
|
@ -8,18 +8,12 @@ namespace AirBomber
|
||||
{
|
||||
public class EntityAirBomber
|
||||
{
|
||||
public int Speed { get; private set; } //скорость
|
||||
|
||||
public int Weight { get; private set; } //вес грузовика
|
||||
|
||||
public Color BodyColor { get; private set; } // основной цвет
|
||||
|
||||
public Color DopColor { get; private set; } // доп цвет
|
||||
|
||||
public bool Toplivo { get; private set; } // топливо
|
||||
|
||||
public bool Rocket { get; private set; } //ракеты
|
||||
|
||||
public int Speed { get; private set; }
|
||||
public int Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public Color DopColor { get; private set; }
|
||||
public bool Toplivo { get; private set; }
|
||||
public bool Rocket { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
|
||||
public void Init(int speed, int weight, Color bodycolor, Color dopcolor, bool toplivo, bool ropcket)
|
||||
|
1
AirBomber/FormAirBomber.Designer.cs
generated
1
AirBomber/FormAirBomber.Designer.cs
generated
@ -45,7 +45,6 @@
|
||||
pictureBox.Size = new Size(800, 450);
|
||||
pictureBox.TabIndex = 0;
|
||||
pictureBox.TabStop = false;
|
||||
pictureBox.Click += pictureBox_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
|
@ -8,10 +8,6 @@ namespace AirBomber
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
|
||||
@ -66,26 +62,5 @@ namespace AirBomber
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
|
||||
private void pictureBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user