79 lines
2.0 KiB
C#
79 lines
2.0 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace ProjectElectricLocomotive.MovementStrategy
|
|||
|
{
|
|||
|
public class ObjectParameters
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Координата X
|
|||
|
/// </summary>
|
|||
|
private readonly int _x;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Координата Y
|
|||
|
/// </summary>
|
|||
|
private readonly int _y;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Ширина обьекта
|
|||
|
/// </summary>
|
|||
|
private readonly int _width;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Высота обьекта
|
|||
|
/// </summary>
|
|||
|
private readonly int _height;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Левая граница
|
|||
|
/// </summary>
|
|||
|
public int LeftBorder => _x;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Вернхняя граница
|
|||
|
/// </summary>
|
|||
|
public int TopBorder => _y;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Правая граница
|
|||
|
/// </summary>
|
|||
|
public int RightBorder => _x + _width;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Нижняя граница
|
|||
|
/// </summary>
|
|||
|
public int DownBorder => _y + _height;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Середина обьекта
|
|||
|
/// </summary>
|
|||
|
public int ObjectMiddleHorizontal => _x + _width / 2;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Середина обьекта
|
|||
|
/// </summary>
|
|||
|
public int ObjectMiddleVertical => _y + _height / 2;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Конструктор
|
|||
|
/// </summary>
|
|||
|
/// <param name="x">Координата X</param>
|
|||
|
/// <param name="y">Координата Y</param>
|
|||
|
/// <param name="width">Ширина объекта</param>
|
|||
|
/// <param name="height">Высота объекта</param>
|
|||
|
public ObjectParameters(int x, int y, int width, int height)
|
|||
|
{
|
|||
|
_x = x;
|
|||
|
_y = y;
|
|||
|
_width = width;
|
|||
|
_height = height;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|