62 lines
1.7 KiB
C#
62 lines
1.7 KiB
C#
using System;
|
|
|
|
/// <summary>
|
|
/// Replay JSON DTOs for admin-panel playback.
|
|
/// Playback contract:
|
|
/// 1. Advance playbackTime with real time (scaled).
|
|
/// 2. Binary-search frames by t; Hermite-interpolate x/y using vx/vy between neighbors.
|
|
/// 3. On reset/goal events (discontinuities): snap to the sample at/after t — do not blend across.
|
|
/// 4. Fire SFX on hit/goal when playbackTime crosses event t.
|
|
/// </summary>
|
|
[Serializable]
|
|
public class ReplayFile
|
|
{
|
|
public int version = 1;
|
|
public int matchId;
|
|
/// <summary>True for localhost practice / tutorial host matches (no dedicated matchmaker id).</summary>
|
|
public bool isPractice;
|
|
public float fixedDeltaTime;
|
|
public float duration;
|
|
public ReplayEntity[] entities;
|
|
public ReplayFrame[] frames;
|
|
public ReplayEvent[] events;
|
|
}
|
|
|
|
[Serializable]
|
|
public class ReplayEntity
|
|
{
|
|
public int id;
|
|
/// <summary>"ball" or "puck"</summary>
|
|
public string type;
|
|
/// <summary>"Red", "Blue", or empty for ball</summary>
|
|
public string team;
|
|
}
|
|
|
|
[Serializable]
|
|
public class ReplayFrame
|
|
{
|
|
public float t;
|
|
public float[] x;
|
|
public float[] y;
|
|
public float[] vx;
|
|
public float[] vy;
|
|
}
|
|
|
|
[Serializable]
|
|
public class ReplayEvent
|
|
{
|
|
public float t;
|
|
/// <summary>"hit", "goal", or "reset"</summary>
|
|
public string type;
|
|
/// <summary>For hits: "puck_puck", "ball_puck", or "ball_wall"</summary>
|
|
public string kind;
|
|
public float vol;
|
|
/// <summary>Entity id for spatial cueing; -1 when N/A</summary>
|
|
public int id = -1;
|
|
/// <summary>For goals: conceding team ("Red"/"Blue")</summary>
|
|
public string team;
|
|
public int redScore;
|
|
public int blueScore;
|
|
public bool kickoff;
|
|
}
|