исправл
This commit is contained in:
commit
d6b298a36c
29
ProjectBulldozer/ProjectBulldozer/DirectionType1.cs
Normal file
29
ProjectBulldozer/ProjectBulldozer/DirectionType1.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectBulldozer;
|
||||
|
||||
public enum DirectionType1
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
|
||||
}
|
||||
//сделано
|
@ -26,9 +26,9 @@ public class DrawningBulldozer
|
||||
/// </summary>
|
||||
private int? _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина прорисовки автомобиля
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Ширина прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _BulldozerWidth = 180;
|
||||
/// <summary>
|
||||
/// Высота прорисовки автомобиля
|
||||
@ -48,7 +48,7 @@ public class DrawningBulldozer
|
||||
additionalColor, bool additionalOtval, bool additionalRihl)
|
||||
{
|
||||
EntityBulldozer = new EntityBulldozer();
|
||||
EntityBulldozer.Init(speed, weight, bodyColor, additionalColor, additionalOtval,
|
||||
EntityBulldozer.Init(speed, weight, bodyColor, additionalColor, additionalOtval,
|
||||
additionalRihl);
|
||||
|
||||
_pictureWidth = null;
|
||||
@ -67,15 +67,15 @@ public class DrawningBulldozer
|
||||
{
|
||||
if (_BulldozerWidth < width && _BulldozerHeight < height)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
SetPosition(_startPosX.Value, _startPosY.Value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
@ -96,9 +96,9 @@ public class DrawningBulldozer
|
||||
}
|
||||
else
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
|
@ -47,7 +47,7 @@ namespace ProjectBulldozer
|
||||
{
|
||||
Random random = new();
|
||||
_drawningBulldozer = new DrawningBulldozer();
|
||||
|
||||
|
||||
_drawningBulldozer.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)),
|
||||
@ -56,12 +56,12 @@ namespace ProjectBulldozer
|
||||
_drawningBulldozer.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
/// <summary>
|
||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
/// <summary>
|
||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningBulldozer == null)
|
||||
{
|
||||
@ -73,19 +73,19 @@ namespace ProjectBulldozer
|
||||
{
|
||||
case "buttonUp":
|
||||
result =
|
||||
_drawningBulldozer.MoveTransport(DirectionType1.Up);
|
||||
_drawningBulldozer.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
result =
|
||||
_drawningBulldozer.MoveTransport(DirectionType1.Down);
|
||||
_drawningBulldozer.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
result =
|
||||
_drawningBulldozer.MoveTransport(DirectionType1.Left);
|
||||
_drawningBulldozer.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
result =
|
||||
_drawningBulldozer.MoveTransport(DirectionType1.Right);
|
||||
_drawningBulldozer.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
if (result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user