2024-08-15 04:12:58 +00:00
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
2022-02-19 00:58:16 +00:00
|
|
|
using MultiversalDiplomacy.Model;
|
|
|
|
|
|
|
|
namespace MultiversalDiplomacy.Orders;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// An order given to a specific unit.
|
|
|
|
/// </summary>
|
2024-08-15 04:12:58 +00:00
|
|
|
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
|
|
|
|
[JsonDerivedType(typeof(ConvoyOrder), typeDiscriminator: "convoy")]
|
|
|
|
[JsonDerivedType(typeof(DisbandOrder), typeDiscriminator: "disband")]
|
|
|
|
[JsonDerivedType(typeof(HoldOrder), typeDiscriminator: "hold")]
|
|
|
|
[JsonDerivedType(typeof(MoveOrder), typeDiscriminator: "move")]
|
|
|
|
[JsonDerivedType(typeof(RetreatOrder), typeDiscriminator: "retreat")]
|
|
|
|
[JsonDerivedType(typeof(SupportHoldOrder), typeDiscriminator: "supportHold")]
|
|
|
|
[JsonDerivedType(typeof(SupportMoveOrder), typeDiscriminator: "supportMove")]
|
2022-02-19 00:58:16 +00:00
|
|
|
public abstract class UnitOrder : Order
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The ordered unit.
|
|
|
|
/// </summary>
|
|
|
|
public Unit Unit { get; }
|
|
|
|
|
|
|
|
public UnitOrder(Power power, Unit unit) : base(power)
|
|
|
|
{
|
|
|
|
this.Unit = unit;
|
|
|
|
}
|
|
|
|
}
|