Lives (floors at zero, exhaustion observable), LevelId, SkillId, PlaythroughId (never self-generates, keeps tests deterministic), StatName enum, LevelTime rejects NaN/infinity. 14 tests. Arithmetic/comparison members deferred to the slices whose behaviour needs them rather than added speculatively.
17 lines
611 B
C#
17 lines
611 B
C#
namespace Mr.BrickAdventures.Progression;
|
|
|
|
/// <summary>
|
|
/// A completion time for one Level. Strictly positive — a zero time means the clock was never
|
|
/// running, which is a defect rather than a fast run.
|
|
/// </summary>
|
|
public readonly struct LevelTime
|
|
{
|
|
public double Seconds { get; }
|
|
|
|
private LevelTime(double seconds) => Seconds = seconds;
|
|
|
|
public static LevelTime Of(double seconds) => double.IsFinite(seconds) && seconds > 0
|
|
? new LevelTime(seconds)
|
|
: throw new ArgumentOutOfRangeException(nameof(seconds), seconds, "A completion time must be a finite positive number.");
|
|
}
|