This commit is contained in:
Калышев Ян 2022-09-25 19:03:41 +04:00
parent 117a3f5659
commit 99aa437848
6 changed files with 7 additions and 15 deletions

View File

@ -32,7 +32,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
public Bitmap MoveObject(Direction direction)
{
// TODO проверка, что объект может переместится в требуемом направлении
if (true)
if (true)
{
_drawningObject.MoveObject(direction);
}

View File

@ -174,7 +174,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _boatWidth, _startPosY + _boatHeight);
return (_startPosX, _startPosX + _boatWidth, _startPosY, _startPosY + _boatHeight);
}
}
}

View File

@ -14,22 +14,18 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
_boat = boat;
}
public float Step => _boat?.Boat?.Step ?? 0;
public void DrawningObject(Graphics g)
{
// TODO
_boat?.DrawTransport(g);
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _boat?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_boat.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_boat.SetPosition(x, y, width, height);

View File

@ -86,7 +86,6 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base.git
{
Random rnd = new();
_boat = new DrawningSportBoat(rnd.Next(5, 30), rnd.Next(30, 100), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
SetData();
Draw();
}

View File

@ -37,9 +37,8 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
var car = new DrawningBoat(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
SetData(car);
var boat = new DrawningBoat(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
SetData(boat);
}
/// <summary>
/// Изменение размеров формы

View File

@ -18,13 +18,11 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
private readonly Brush roadColor = new SolidBrush(Color.Gray);
protected override void DrawBarrierPart(Graphics g, int i, int j)
{
g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x +
1), j * (_size_y + 1));
g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected override void DrawRoadPart(Graphics g, int i, int j)
{
g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x +
1), j * (_size_y + 1));
g.FillRectangle(roadColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected override void GenerateMap()
{