2024-04-18 13:11:34 +04:00
|
|
|
|
|
2024-08-29 19:32:46 +04:00
|
|
|
|
using static System.Reflection.Metadata.BlobBuilder;
|
|
|
|
|
using System.Net.Sockets;
|
|
|
|
|
|
2024-04-24 09:28:37 +04:00
|
|
|
|
namespace lab1.Entities;
|
2024-04-18 13:11:34 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс-сущность "Истребитель"
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
2024-04-24 09:28:37 +04:00
|
|
|
|
public class EntityFighter : EntityTrackedVehicle
|
2024-04-18 13:11:34 +04:00
|
|
|
|
{
|
2024-04-24 09:28:37 +04:00
|
|
|
|
|
2024-04-18 13:11:34 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Дополнительный цвет (для опциональных элементов)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Color AdditionalColor { get; private set; }
|
|
|
|
|
/// <summary>
|
2024-05-23 08:43:54 +04:00
|
|
|
|
/// Признак (опция) наличия ковша
|
2024-04-18 13:11:34 +04:00
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Kovsh { get; private set; }
|
2024-08-29 19:32:46 +04:00
|
|
|
|
public void setBodyTankColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
AdditionalColor = color;
|
|
|
|
|
}
|
2024-04-18 13:11:34 +04:00
|
|
|
|
/// <summary>
|
2024-05-23 08:43:54 +04:00
|
|
|
|
/// Признак (опция) наличия опор для фиксации
|
2024-04-18 13:11:34 +04:00
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Otval { get; private set; }
|
2024-04-24 09:28:37 +04:00
|
|
|
|
|
2024-04-18 13:11:34 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Инициализация полей объекта-класса истребителя
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">>Вес истребителя</param>
|
|
|
|
|
/// <param name="bodyColor">Основной цвет</param>
|
|
|
|
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
|
|
|
/// <param name="rockets">Признак наличия ракет</param>
|
|
|
|
|
/// <param name="extraWings">Признак наличия доп. крыльев</param>
|
|
|
|
|
|
2024-04-24 09:28:37 +04:00
|
|
|
|
public EntityFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings) : base(speed, weight, bodyColor)
|
2024-04-18 13:11:34 +04:00
|
|
|
|
{
|
2024-04-24 09:28:37 +04:00
|
|
|
|
|
2024-04-18 13:11:34 +04:00
|
|
|
|
AdditionalColor = additionalColor;
|
|
|
|
|
Kovsh = rockets;
|
|
|
|
|
Otval = extraWings;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-29 19:32:46 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение строк со значениями свойств объекта класса-сущности
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public override string[] GetStringRepresentation()
|
|
|
|
|
{
|
|
|
|
|
return new[] { nameof(EntityFighter), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name, Kovsh.ToString(), Otval.ToString() };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Создание объекта из массива строк
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strs"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static EntityFighter? CreateEntityStormtrooper(string[] strs)
|
|
|
|
|
{
|
|
|
|
|
if (strs.Length != 7 || strs[0] != nameof(EntityFighter))
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new EntityFighter(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]), Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]));
|
|
|
|
|
}
|
2024-10-22 13:37:29 +04:00
|
|
|
|
|
|
|
|
|
internal static EntityTrackedVehicle? CreateEntityFighter(string[] strs)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2024-04-18 13:11:34 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-08-29 19:32:46 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|