using System; using Loom; public enum GameScreen { Hud, Pause } [Bridge] public partial class UIBridge : LoomBridgeBase { public GameScreen CurrentScreen { get; set; } = GameScreen.Hud; public int Score { get; set; } private Action _setPaused; // Called by the scene component, not exposed to the UI. public void SetPauseHandler(Action handler) => _setPaused = handler; [BridgeAction] public void Pause() => ChangePause(true); [BridgeAction] public void Resume() => ChangePause(false); [BridgeAction] public void ResetScore() => Score = 0; private void ChangePause(bool paused) { if (_setPaused == null) throw new InvalidOperationException("PauseMenuController is not active."); _setPaused(paused); CurrentScreen = paused ? GameScreen.Pause : GameScreen.Hud; } }