Lab1 perfecto
This commit is contained in:
parent
bb6a8b0275
commit
aef61e0dc3
@ -7,22 +7,40 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Trolleybus
|
namespace Trolleybus
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||||
|
/// </summary>
|
||||||
public class DrawingTrolleybus
|
public class DrawingTrolleybus
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс-сущность
|
||||||
|
/// </summary>
|
||||||
public EntityTrolleybus? EntityTrolleybus { get; private set; }
|
public EntityTrolleybus? EntityTrolleybus { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина окна
|
||||||
|
/// </summary>
|
||||||
private int _pictureWidth;
|
private int _pictureWidth;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота окна
|
||||||
|
/// </summary>
|
||||||
private int _pictureHeight;
|
private int _pictureHeight;
|
||||||
|
/// <summary>
|
||||||
|
/// Левая координата прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
private int _startPosX;
|
private int _startPosX;
|
||||||
|
/// <summary>
|
||||||
|
/// Верхняя кооридната прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
private int _startPosY;
|
private int _startPosY;
|
||||||
|
/// <summary>
|
||||||
|
/// Ширина прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
private readonly int _trolleybusWidth = 170;
|
private readonly int _trolleybusWidth = 170;
|
||||||
|
/// <summary>
|
||||||
|
/// Высота прорисовки автомобиля
|
||||||
|
/// </summary>
|
||||||
private readonly int _trolleybusHeight = 124;
|
private readonly int _trolleybusHeight = 124;
|
||||||
|
|
||||||
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool roga, bool battery, int width, int height)
|
public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool roga, bool battery, int width, int height)
|
||||||
{
|
{
|
||||||
_pictureWidth = width;
|
_pictureWidth = width;
|
||||||
@ -108,7 +126,7 @@ namespace Trolleybus
|
|||||||
g.FillEllipse(brBlue, _startPosX + 95, _startPosY + 40, 20, 40);
|
g.FillEllipse(brBlue, _startPosX + 95, _startPosY + 40, 20, 40);
|
||||||
g.FillEllipse(brBlue, _startPosX + 120, _startPosY + 40, 20, 40);
|
g.FillEllipse(brBlue, _startPosX + 120, _startPosY + 40, 20, 40);
|
||||||
//дверь
|
//дверь
|
||||||
Brush brDoor = new SolidBrush(EntityTrolleybus.AdditionalColor);
|
Brush brDoor = new SolidBrush(EntityTrolleybus.BodyColor);
|
||||||
g.FillRectangle(brDoor, _startPosX + 60, _startPosY + 50, 30, 60);
|
g.FillRectangle(brDoor, _startPosX + 60, _startPosY + 50, 30, 60);
|
||||||
//колеса
|
//колеса
|
||||||
Brush brblack = new SolidBrush(Color.Black);
|
Brush brblack = new SolidBrush(Color.Black);
|
||||||
|
@ -8,20 +8,34 @@ namespace Trolleybus
|
|||||||
{
|
{
|
||||||
public class EntityTrolleybus
|
public class EntityTrolleybus
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Скорость
|
||||||
|
/// </summary>
|
||||||
public int Speed { get; private set; }
|
public int Speed { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Вес
|
||||||
|
/// </summary>
|
||||||
public double Weight { get; private set; }
|
public double Weight { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Основной цвет
|
||||||
|
/// </summary>
|
||||||
public Color BodyColor { get; private set; }
|
public Color BodyColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Дополнительный цвет (для опциональных элементов)
|
||||||
|
/// </summary>
|
||||||
public Color AdditionalColor { get; private set; }
|
public Color AdditionalColor { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия рогов
|
||||||
|
/// </summary>
|
||||||
public bool Roga { get; private set; }
|
public bool Roga { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Признак (опция) наличия батареи
|
||||||
|
/// </summary>
|
||||||
public bool Battery { get; private set; }
|
public bool Battery { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Шаг перемещения автомобиля
|
||||||
|
/// </summary>
|
||||||
public double Step => (double)Speed * 100 / Weight;
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
public void Init(int speed, double weight, Color bodyColor, Color
|
||||||
additionalColor, bool roga, bool battery)
|
additionalColor, bool roga, bool battery)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ namespace Trolleybus
|
|||||||
public partial class FormTrolleybus : Form
|
public partial class FormTrolleybus : Form
|
||||||
{
|
{
|
||||||
private DrawingTrolleybus? _drawningTrolleybus;
|
private DrawingTrolleybus? _drawningTrolleybus;
|
||||||
|
|
||||||
public FormTrolleybus()
|
public FormTrolleybus()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Loading…
Reference in New Issue
Block a user