Создание папки Entities
This commit is contained in:
parent
9f13fc6a95
commit
a0f64e592f
@ -1,4 +1,4 @@
|
||||
namespace ProjectAirplaneWithRadar
|
||||
namespace ProjectAirplaneWithRadar.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
@ -72,18 +72,18 @@
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if(_startPosX != null && _startPosY != null)
|
||||
if (_startPosX != null && _startPosY != null)
|
||||
{
|
||||
if(_startPosX.Value < 0)
|
||||
if (_startPosX.Value < 0)
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
if(_startPosY.Value < 0)
|
||||
if (_startPosY.Value < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
|
||||
if(_startPosX.Value + PlaneWidth > _pictureWidth)
|
||||
if (_startPosX.Value + PlaneWidth > _pictureWidth)
|
||||
{
|
||||
_startPosX = _pictureWidth - PlaneWidth;
|
||||
}
|
||||
@ -116,7 +116,7 @@
|
||||
{
|
||||
_startPosX = 0;
|
||||
}
|
||||
if(_startPosY.Value < 0)
|
||||
if (_startPosY.Value < 0)
|
||||
{
|
||||
_startPosY = 0;
|
||||
}
|
||||
@ -227,7 +227,7 @@
|
||||
}
|
||||
|
||||
//Корпус
|
||||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 50,100,30);
|
||||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 50, 100, 30);
|
||||
|
||||
//Хвост
|
||||
Point[] points = {
|
||||
|
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ProjectAirplaneWithRadar.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность "Самолет"
|
||||
/// </summary>
|
||||
public class EntityAirplane
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public EntityAirplane(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +1,10 @@
|
||||
namespace ProjectAirplaneWithRadar
|
||||
namespace ProjectAirplaneWithRadar.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность "Самолет с радаром"
|
||||
/// </summary>
|
||||
public class EntityAirplaneWithRadar
|
||||
public class EntityAirplaneWithRadar : EntityAirplane
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
@ -35,11 +20,6 @@
|
||||
/// </summary>
|
||||
public bool Radar { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса самолета с радаром
|
||||
/// </summary>
|
||||
@ -49,11 +29,8 @@
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="wheels">Шасси</param>
|
||||
/// <param name="radar">Радар</param>
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar)
|
||||
public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar) : base(speed, weight, bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
Wheels = wheels;
|
||||
Radar = radar;
|
@ -1,4 +1,6 @@
|
||||
namespace ProjectAirplaneWithRadar
|
||||
using ProjectAirplaneWithRadar.Entities;
|
||||
|
||||
namespace ProjectAirplaneWithRadar
|
||||
{
|
||||
/// <summary>
|
||||
/// Форма работы с объектом "Самолет с радаром"
|
||||
|
Loading…
Reference in New Issue
Block a user