2024-03-07 09:46:27 +04:00
|
|
|
|
namespace ProjectCruiser.Entities
|
|
|
|
|
{
|
|
|
|
|
internal class EntityMilitaryCruiser : EntityCruiser
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Признак (опция) наличие вертолетной площадки
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool HelicopterArea { get; private set; }
|
2024-05-13 12:59:51 +04:00
|
|
|
|
|
2024-03-07 09:46:27 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Признак (опция) наличие шлюпок
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Boat { get; private set; }
|
2024-05-13 12:59:51 +04:00
|
|
|
|
|
2024-03-07 09:46:27 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Признак (опция) наличие пушки
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Weapon { get; private set; }
|
2024-05-13 12:59:51 +04:00
|
|
|
|
|
2024-03-07 09:46:27 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Дополнительный цвет (для опциональных элементов)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Color AdditionalColor { get; private set; }
|
2024-05-13 12:59:51 +04:00
|
|
|
|
public void setAdditionalColor(Color color)
|
|
|
|
|
{
|
|
|
|
|
AdditionalColor = color;
|
|
|
|
|
}
|
2024-03-07 09:46:27 +04:00
|
|
|
|
|
|
|
|
|
public EntityMilitaryCruiser(int speed, double weight, Color bodyColor, Color additionalColor, bool helicopterArea, bool boat, bool weapon) : base(speed, weight, bodyColor)
|
|
|
|
|
{
|
|
|
|
|
AdditionalColor = additionalColor;
|
|
|
|
|
HelicopterArea = helicopterArea;
|
|
|
|
|
Boat = boat;
|
|
|
|
|
Weapon = weapon;
|
|
|
|
|
}
|
2024-05-13 12:59:51 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение строк со значениями свойств объекта класса-сущности
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public override string[] GetStringRepresentation()
|
|
|
|
|
{
|
|
|
|
|
return new[] { nameof(EntityCruiser), Speed.ToString(), Weight.ToString(), BodyColor.Name, AdditionalColor.Name,
|
|
|
|
|
HelicopterArea.ToString(), Boat.ToString(), Weapon.ToString() };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Создание объекта из массива строк
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="strs"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static EntityCruiser? CreateEntityMilitaryCruiser(string[] strs)
|
|
|
|
|
{
|
|
|
|
|
if (strs.Length != 8 || strs[0] != nameof(EntityCruiser))
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new EntityMilitaryCruiser(Convert.ToInt32(strs[1]), Convert.ToDouble(strs[2]), Color.FromName(strs[3]), Color.FromName(strs[4]),
|
|
|
|
|
Convert.ToBoolean(strs[5]), Convert.ToBoolean(strs[6]), Convert.ToBoolean(strs[7]));
|
|
|
|
|
}
|
2024-03-07 09:46:27 +04:00
|
|
|
|
}
|
|
|
|
|
}
|