Interface for race lap and ghost events. Defines LapCompleteInfo and GhostBeatenInfo record structs and an ILapTimeEvents scene event interface with default handlers OnLapCompleted and OnGhostBeaten.
using Machines.Player;
namespace Machines.Events;
public record struct LapCompleteInfo( Car Car, int Lap, float LapTime, bool IsPersonalBest );
public record struct GhostBeatenInfo( Car Car, float PlayerTime, float GhostTime, string GhostPlayerName );
/// <summary>
/// Fired for lap completions and ghost interactions during a race.
/// </summary>
public interface ILapTimeEvents : ISceneEvent<ILapTimeEvents>
{
/// <summary>
/// Called when a player completes a lap.
/// </summary>
void OnLapCompleted( LapCompleteInfo info ) { }
/// <summary>
/// Called when a player's lap time beats the ghost.
/// </summary>
void OnGhostBeaten( GhostBeatenInfo info ) { }
}