Chessistics/chessistics-engine/Model/PieceState.cs

32 lines
944 B
C#
Raw Normal View History

namespace Chessistics.Engine.Model;
public class PieceState
{
public int Id { get; }
public PieceKind Kind { get; }
public Coords StartCell { get; }
public Coords EndCell { get; }
public Coords CurrentCell { get; set; }
public CargoType? Cargo { get; set; }
public CargoType? CargoFilter { get; set; }
public int SocialStatus { get; }
public int PlacementOrder { get; }
public PieceState(int id, PieceKind kind, Coords startCell, Coords endCell, int placementOrder)
{
Id = id;
Kind = kind;
StartCell = startCell;
EndCell = endCell;
CurrentCell = startCell;
Cargo = null;
SocialStatus = PieceRules.GetSocialStatus(kind);
PlacementOrder = placementOrder;
}
/// <summary>
/// Returns the cell this piece will move to next.
/// </summary>
public Coords TargetCell => CurrentCell == StartCell ? EndCell : StartCell;
}