Game/BlockResult.cs
namespace BlockParty;
/// <summary>
/// Immutable snapshot of a block's final state at game-over: enough to re-display it on the
/// score screen and tally its points after the live <see cref="Block"/> has been destroyed.
/// </summary>
public struct BlockResult
{
public BlockType Type;
/// <summary>True if this block ORIGINATED as a <see cref="BlockType.Mimic"/>. A mimic swaps itself
/// for a disguise instance at every phase-up, so <see cref="Type"/> is always the disguise by the
/// time a result is built — this flag (from the surviving <see cref="Block.Mimic"/> state) is the
/// only way to credit Mimic itself in the block-type collection achievement.</summary>
public bool WasMimic;
public string SpritePath;
public int Phase;
public Direction MoveDirection;
public bool Left, Right, Up, Down;
public int ScoreStartPhase;
public bool ScoreStartLeft, ScoreStartRight, ScoreStartUp, ScoreStartDown;
public bool IsPressed( Direction dir ) => dir switch
{
Direction.Left => Left,
Direction.Right => Right,
Direction.Up => Up,
Direction.Down => Down,
_ => false,
};
public bool WasPressedAtScoreStart( Direction dir ) => dir switch
{
Direction.Left => ScoreStartLeft,
Direction.Right => ScoreStartRight,
Direction.Up => ScoreStartUp,
Direction.Down => ScoreStartDown,
_ => false,
};
public int PressedCount => (Left ? 1 : 0) + (Right ? 1 : 0) + (Up ? 1 : 0) + (Down ? 1 : 0);
}