Добавлен класс сущности базового и продвинутого объектов
This commit is contained in:
parent
9b84704e46
commit
e9c0b5160f
@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
using ProjectBulldozer.Entities;
|
||||||
|
|
||||||
namespace ProjectBulldozer
|
namespace ProjectBulldozer
|
||||||
{
|
{
|
||||||
internal class DrawningBulldozer
|
internal class DrawningBulldozer
|
||||||
|
22
ProjectBulldozer/Entities/EntityBulldozer.cs
Normal file
22
ProjectBulldozer/Entities/EntityBulldozer.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectBulldozer.Entities
|
||||||
|
{
|
||||||
|
public class EntityBulldozer : EntityTractor
|
||||||
|
{
|
||||||
|
public Color AdditionalColor { get; private set; }
|
||||||
|
public bool Otval { get; private set; }
|
||||||
|
public bool SeifBatteries { get; private set; }
|
||||||
|
public EntityBulldozer(int speed, double weight, Color bodyColor, Color additionalColor, bool otval,
|
||||||
|
bool seifBatteries) : base(speed, weight, bodyColor)
|
||||||
|
{
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Otval = otval;
|
||||||
|
SeifBatteries = seifBatteries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
ProjectBulldozer/Entities/EntityTractor.cs
Normal file
22
ProjectBulldozer/Entities/EntityTractor.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectBulldozer.Entities
|
||||||
|
{
|
||||||
|
public class EntityTractor
|
||||||
|
{
|
||||||
|
public int Speed { get; private set; }
|
||||||
|
public double Weight { get; private set; }
|
||||||
|
public Color BodyColor { get; private set; }
|
||||||
|
public double Step => (double)Speed * 100 / Weight;
|
||||||
|
public EntityTractor(int speed, double weight, Color bodyColor)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,43 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ProjectBulldozer
|
|
||||||
{
|
|
||||||
public class EntityBulldozer
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public int Speed { get; private set; }
|
|
||||||
public double Weight { get; private set; }
|
|
||||||
public Color BodyColor { get; private set; }
|
|
||||||
public Color AdditionalColor { get; private set; }
|
|
||||||
public bool AdditionalEngine { get; private set; }
|
|
||||||
public bool AdditionalCompartment { get; private set; }
|
|
||||||
public double Step => (double)Speed * 240 / Weight;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация полей объекта-класса бульдозера
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес бульдозера</param>
|
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="additionalEngine">Признак наличия дополнительного катка</param>
|
|
||||||
/// <param name="additionalCompartment">Признак наличия гусениц</param>
|
|
||||||
public void Init(int speed, double weight, Color bodyColor, Color
|
|
||||||
additionalColor, bool additionalEngine, bool additionalCompartment)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
Weight = weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
AdditionalEngine = additionalEngine;
|
|
||||||
AdditionalColor = additionalColor;
|
|
||||||
|
|
||||||
AdditionalCompartment = additionalCompartment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user