using System; using Godot; public partial class GameManager : Node { public static bool IsPlaying = true; public ulong GameStart = 0; public ulong GameEnd = 0; public int Attempts = 0; public Node2D Checkpoint = null; [Signal] public delegate void GameOverEventHandler(); public override void _Ready() { if (!IsPlaying) { IsPlaying = true; } StartGame(); } public void StartGame() => GameStart = Time.GetTicksMsec(); public void EndGame() { GameEnd = Time.GetTicksMsec(); EmitSignal(SignalName.GameOver); } public string GetFormattedTimeElapsed() => TimeSpan.FromMilliseconds(GameEnd - GameStart).ToString(@"hh\:mm\:ss.fff"); public void OnPlayerDied() => Attempts++; }