Убрал KellHeight
This commit is contained in:
parent
d8fa13de94
commit
102b4cffde
@ -19,9 +19,7 @@ public class DrawingSeaplane
|
|||||||
|
|
||||||
private readonly int _drawingSeaplaneWidth = 190;
|
private readonly int _drawingSeaplaneWidth = 190;
|
||||||
|
|
||||||
private readonly int _drawingSeaplaneHeight = 90;
|
private readonly int _drawingSeaplaneHeight = 85;
|
||||||
|
|
||||||
private readonly int _drawingKeelHeight = 35;
|
|
||||||
|
|
||||||
public void Init (int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool inflatableBoat)
|
public void Init (int speed, double weight, Color bodyColor, Color additionalColor, bool floats, bool inflatableBoat)
|
||||||
{
|
{
|
||||||
@ -75,9 +73,9 @@ public class DrawingSeaplane
|
|||||||
x = _pictureWidth.Value - _drawingSeaplaneWidth - _drawingSeaplaneWidth;
|
x = _pictureWidth.Value - _drawingSeaplaneWidth - _drawingSeaplaneWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y - _drawingKeelHeight < 0)
|
if (y < 0)
|
||||||
{
|
{
|
||||||
y = _drawingKeelHeight;
|
y = 0;
|
||||||
}
|
}
|
||||||
else if (y - _drawingSeaplaneHeight >= _pictureHeight)
|
else if (y - _drawingSeaplaneHeight >= _pictureHeight)
|
||||||
{
|
{
|
||||||
@ -106,7 +104,7 @@ public class DrawingSeaplane
|
|||||||
return true;
|
return true;
|
||||||
//вверх
|
//вверх
|
||||||
case DirectionType.Up:
|
case DirectionType.Up:
|
||||||
if (_startPosY.Value - _drawingKeelHeight - EntitySeaplane.Step >= 0)
|
if (_startPosY.Value - EntitySeaplane.Step >= 0)
|
||||||
{
|
{
|
||||||
_startPosY -= (int)EntitySeaplane.Step;
|
_startPosY -= (int)EntitySeaplane.Step;
|
||||||
}
|
}
|
||||||
@ -120,7 +118,7 @@ public class DrawingSeaplane
|
|||||||
return true;
|
return true;
|
||||||
//вниз
|
//вниз
|
||||||
case DirectionType.Down:
|
case DirectionType.Down:
|
||||||
if (_startPosY.Value + EntitySeaplane.Step <= _pictureHeight.Value - _drawingSeaplaneHeight + _drawingKeelHeight)
|
if (_startPosY.Value + EntitySeaplane.Step <= _pictureHeight.Value - _drawingSeaplaneHeight)
|
||||||
{
|
{
|
||||||
_startPosY += (int)EntitySeaplane.Step;
|
_startPosY += (int)EntitySeaplane.Step;
|
||||||
}
|
}
|
||||||
@ -144,58 +142,58 @@ public class DrawingSeaplane
|
|||||||
Brush brRed = new SolidBrush(Color.Red);
|
Brush brRed = new SolidBrush(Color.Red);
|
||||||
|
|
||||||
//границы самолета
|
//границы самолета
|
||||||
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 4, 20, 20);
|
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 34, 20, 20);
|
||||||
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 14, 20, 20);
|
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 44, 20, 20);
|
||||||
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 15, 10, 10);
|
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 45, 10, 10);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 170, _startPosY.Value + 15, 10, 10);
|
g.DrawRectangle(pen, _startPosX.Value + 170, _startPosY.Value + 45, 10, 10);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 4, 160, 30);
|
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 34, 160, 30);
|
||||||
|
|
||||||
Point[] pointsFaceTop = {
|
Point[] pointsFaceTop = {
|
||||||
new Point(_startPosX.Value + 170, _startPosY.Value),
|
new Point(_startPosX.Value + 170, _startPosY.Value+30),
|
||||||
new Point(_startPosX.Value + 170, _startPosY.Value + 20),
|
new Point(_startPosX.Value + 170, _startPosY.Value + 50),
|
||||||
new Point(_startPosX.Value + 190, _startPosY.Value + 20)
|
new Point(_startPosX.Value + 190, _startPosY.Value + 50)
|
||||||
};
|
};
|
||||||
g.DrawPolygon(pen, pointsFaceTop);
|
g.DrawPolygon(pen, pointsFaceTop);
|
||||||
|
|
||||||
Point[] pointsFaceBottom = {
|
Point[] pointsFaceBottom = {
|
||||||
new Point(_startPosX.Value + 170, _startPosY.Value + 40),
|
new Point(_startPosX.Value + 170, _startPosY.Value + 70),
|
||||||
new Point(_startPosX.Value + 170, _startPosY.Value + 20),
|
new Point(_startPosX.Value + 170, _startPosY.Value + 50),
|
||||||
new Point(_startPosX.Value + 190, _startPosY.Value + 20)
|
new Point(_startPosX.Value + 190, _startPosY.Value + 50)
|
||||||
};
|
};
|
||||||
g.DrawPolygon(pen, pointsFaceBottom);
|
g.DrawPolygon(pen, pointsFaceBottom);
|
||||||
|
|
||||||
Point[] pointsKeel = {
|
Point[] pointsKeel = {
|
||||||
new Point(_startPosX.Value + 10, _startPosY.Value - 30),
|
new Point(_startPosX.Value + 10, _startPosY.Value),
|
||||||
new Point(_startPosX.Value + 10, _startPosY.Value + 5),
|
new Point(_startPosX.Value + 10, _startPosY.Value+35),
|
||||||
new Point(_startPosX.Value + 50, _startPosY.Value + 5)
|
new Point(_startPosX.Value + 50, _startPosY.Value+35)
|
||||||
};
|
};
|
||||||
g.DrawPolygon(pen, pointsKeel);
|
g.DrawPolygon(pen, pointsKeel);
|
||||||
|
|
||||||
if (!EntitySeaplane.Floats)
|
if (!EntitySeaplane.Floats)
|
||||||
{
|
{
|
||||||
// Рисуем переднее шасси с одним колесом
|
// Рисуем переднее шасси с одним колесом
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 140, _startPosY.Value + 45, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 140, _startPosY.Value + 75, 10, 10);
|
||||||
|
|
||||||
// Рисуем задние шасси с двумя колесами
|
// Рисуем задние шасси с двумя колесами
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 45, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 75, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 45, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 75, 10, 10);
|
||||||
|
|
||||||
// Рисуем ногу переднего шасси
|
// Рисуем ногу переднего шасси
|
||||||
g.DrawLine(pen, _startPosX.Value + 145, _startPosY.Value + 35, _startPosX.Value + 145, _startPosY.Value + 50);
|
g.DrawLine(pen, _startPosX.Value + 145, _startPosY.Value + 65, _startPosX.Value + 145, _startPosY.Value + 80);
|
||||||
|
|
||||||
// Рисуем ноги заднего шасси
|
// Рисуем ноги заднего шасси
|
||||||
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 35, _startPosX.Value + 30, _startPosY.Value + 50);
|
g.DrawLine(pen, _startPosX.Value + 30, _startPosY.Value + 65, _startPosX.Value + 30, _startPosY.Value + 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Рисуем триммера
|
// Рисуем триммера
|
||||||
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value+30, 10, 10);
|
||||||
g.DrawEllipse(pen, _startPosX.Value+30, _startPosY.Value, 10, 10);
|
g.DrawEllipse(pen, _startPosX.Value+30, _startPosY.Value+30, 10, 10);
|
||||||
g.DrawRectangle(pen, _startPosX.Value+5, _startPosY.Value, 30, 10);
|
g.DrawRectangle(pen, _startPosX.Value+5, _startPosY.Value+30, 30, 10);
|
||||||
|
|
||||||
// Рисуем крыло
|
// Рисуем крыло
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 70, _startPosY.Value + 15, 6, 6);
|
g.DrawEllipse(pen, _startPosX.Value + 70, _startPosY.Value + 45, 6, 6);
|
||||||
g.DrawEllipse(pen, _startPosX.Value + 130, _startPosY.Value + 15, 6, 6);
|
g.DrawEllipse(pen, _startPosX.Value + 130, _startPosY.Value + 45, 6, 6);
|
||||||
g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + 15, 60, 6);
|
g.DrawRectangle(pen, _startPosX.Value + 75, _startPosY.Value + 45, 60, 6);
|
||||||
|
|
||||||
// Закрашиваем носовую часть и киль
|
// Закрашиваем носовую часть и киль
|
||||||
g.FillPolygon(additionalBrush, pointsFaceBottom);
|
g.FillPolygon(additionalBrush, pointsFaceBottom);
|
||||||
@ -203,38 +201,38 @@ public class DrawingSeaplane
|
|||||||
g.FillPolygon(additionalBrush, pointsKeel);
|
g.FillPolygon(additionalBrush, pointsKeel);
|
||||||
|
|
||||||
// Закрашиваем корпус
|
// Закрашиваем корпус
|
||||||
g.FillEllipse(bodyBrush, _startPosX.Value, _startPosY.Value + 4, 20, 20);
|
g.FillEllipse(bodyBrush, _startPosX.Value, _startPosY.Value + 34, 20, 20);
|
||||||
g.FillEllipse(bodyBrush, _startPosX.Value, _startPosY.Value + 14, 20, 20);
|
g.FillEllipse(bodyBrush, _startPosX.Value, _startPosY.Value + 44, 20, 20);
|
||||||
g.FillRectangle(bodyBrush, _startPosX.Value, _startPosY.Value + 15, 10, 10);
|
g.FillRectangle(bodyBrush, _startPosX.Value, _startPosY.Value + 45, 10, 10);
|
||||||
g.FillRectangle(bodyBrush, _startPosX.Value + 10, _startPosY.Value + 4, 160, 30);
|
g.FillRectangle(bodyBrush, _startPosX.Value + 10, _startPosY.Value + 34, 160, 30);
|
||||||
|
|
||||||
// Закрашиваем триммера
|
// Закрашиваем триммера
|
||||||
g.FillEllipse(brBlack, _startPosX.Value, _startPosY.Value, 10, 10);
|
g.FillEllipse(brBlack, _startPosX.Value, _startPosY.Value+30, 10, 10);
|
||||||
g.FillEllipse(brBlack, _startPosX.Value + 30, _startPosY.Value, 10, 10);
|
g.FillEllipse(brBlack, _startPosX.Value + 30, _startPosY.Value+30, 10, 10);
|
||||||
g.FillRectangle(brBlack, _startPosX.Value + 5, _startPosY.Value, 30, 10);
|
g.FillRectangle(brBlack, _startPosX.Value + 5, _startPosY.Value+30, 30, 10);
|
||||||
|
|
||||||
// Закрашиваем крыло
|
// Закрашиваем крыло
|
||||||
g.FillEllipse(brBlack, _startPosX.Value + 70, _startPosY.Value + 14, 6, 6);
|
g.FillEllipse(brBlack, _startPosX.Value + 70, _startPosY.Value + 44, 6, 6);
|
||||||
g.FillEllipse(brBlack, _startPosX.Value + 130, _startPosY.Value + 14, 6, 6);
|
g.FillEllipse(brBlack, _startPosX.Value + 130, _startPosY.Value + 44, 6, 6);
|
||||||
g.FillRectangle(brBlack, _startPosX.Value + 75, _startPosY.Value + 15, 60, 5);
|
g.FillRectangle(brBlack, _startPosX.Value + 75, _startPosY.Value + 45, 60, 5);
|
||||||
|
|
||||||
// Поплавки
|
// Поплавки
|
||||||
if (EntitySeaplane.Floats)
|
if (EntitySeaplane.Floats)
|
||||||
{
|
{
|
||||||
g.DrawLine(pen, _startPosX.Value + 125, _startPosY.Value + 35, _startPosX.Value + 125, _startPosY.Value + 50);
|
g.DrawLine(pen, _startPosX.Value + 125, _startPosY.Value + 65, _startPosX.Value + 125, _startPosY.Value + 80);
|
||||||
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 35, _startPosX.Value + 50, _startPosY.Value + 50);
|
g.DrawLine(pen, _startPosX.Value + 50, _startPosY.Value + 65, _startPosX.Value + 50, _startPosY.Value + 80);
|
||||||
g.FillEllipse(brBlack, _startPosX.Value + 40, _startPosY.Value + 45, 10, 10);
|
g.FillEllipse(brBlack, _startPosX.Value + 40, _startPosY.Value + 75, 10, 10);
|
||||||
g.FillEllipse(brBlack, _startPosX.Value + 125, _startPosY.Value + 45, 10, 10);
|
g.FillEllipse(brBlack, _startPosX.Value + 125, _startPosY.Value + 75, 10, 10);
|
||||||
g.FillRectangle(brBlack, _startPosX.Value + 45, _startPosY.Value + 45, 85, 10);
|
g.FillRectangle(brBlack, _startPosX.Value + 45, _startPosY.Value + 75, 85, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Надувная лодка
|
// Надувная лодка
|
||||||
if (EntitySeaplane.InflatableBoat)
|
if (EntitySeaplane.InflatableBoat)
|
||||||
{
|
{
|
||||||
g.FillEllipse(brRed, _startPosX.Value, _startPosY.Value + 30, 8, 8);
|
g.FillEllipse(brRed, _startPosX.Value, _startPosY.Value + 60, 8, 8);
|
||||||
g.FillEllipse(brRed, _startPosX.Value + 165, _startPosY.Value + 30, 8, 8);
|
g.FillEllipse(brRed, _startPosX.Value + 165, _startPosY.Value + 60, 8, 8);
|
||||||
g.FillRectangle(brRed, _startPosX.Value + 4, _startPosY.Value + 30, 165, 8);
|
g.FillRectangle(brRed, _startPosX.Value + 4, _startPosY.Value + 60, 165, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,16 +32,6 @@ namespace ProjectSeaplane
|
|||||||
pictureBoxSeaplane.Image = bmp;
|
pictureBoxSeaplane.Image = bmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pictureBox1_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new();
|
Random random = new();
|
||||||
@ -52,7 +42,7 @@ namespace ProjectSeaplane
|
|||||||
Convert.ToBoolean(random.Next(0,2)), Convert.ToBoolean(random.Next(0, 2))
|
Convert.ToBoolean(random.Next(0,2)), Convert.ToBoolean(random.Next(0, 2))
|
||||||
);
|
);
|
||||||
_drawingSeaplane.SetPictureSize(pictureBoxSeaplane.Width, pictureBoxSeaplane.Height);
|
_drawingSeaplane.SetPictureSize(pictureBoxSeaplane.Width, pictureBoxSeaplane.Height);
|
||||||
_drawingSeaplane.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
_drawingSeaplane.SetPosition(pictureBoxSeaplane.Width - 190 - random.Next(10, 100), pictureBoxSeaplane.Height - 85 - random.Next(10, 100));
|
||||||
|
|
||||||
Draw();
|
Draw();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user