5dplomacy/MultiversalDiplomacy/Orders/UnitOrder.cs

29 lines
967 B
C#

using System.Text.Json.Serialization;
using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Orders;
/// <summary>
/// An order given to a specific unit.
/// </summary>
[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")]
public abstract class UnitOrder : Order
{
/// <summary>
/// The ordered unit.
/// </summary>
public Unit Unit { get; }
public UnitOrder(string power, Unit unit) : base(power)
{
this.Unit = unit;
}
}