diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-15 20:00:47 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-15 20:00:47 -0300 |
| commit | 862b399fa37e6ca692d38177a22ee34860d2251e (patch) | |
| tree | 3c0c80efbe0096c8e8d606ee464b54b55eaa209c /scripts/Game.cs | |
| parent | befb39054656e3242e9408f2afe8c902df471ffa (diff) | |
Menu principal
Diffstat (limited to 'scripts/Game.cs')
| -rw-r--r-- | scripts/Game.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/Game.cs b/scripts/Game.cs index 5c1b634..3bb1b83 100644 --- a/scripts/Game.cs +++ b/scripts/Game.cs @@ -33,10 +33,18 @@ public partial class Game : Node private Hud hud; + [Signal] + public delegate void MainMenuRequestedEventHandler(); + + private SignalBus.EscapeRequestedEventHandler escapeLambda; + public override void _Ready() { base._Ready(); + escapeLambda = () => EmitSignal(SignalName.MainMenuRequested); + SignalBus.Instance.EscapeRequested += escapeLambda; + Map = GetNode<Map.Map>("Map"); InputHandler = GetNode<InputHandler>("InputHandler"); @@ -61,6 +69,19 @@ public partial class Game : Node MessageLogData.Instance.AddMessage("Boa sorte!"); } + public override void _Notification(int what) + { + if (what == NotificationPredelete) + { + if (escapeLambda != null) + { + SignalBus.Instance.EscapeRequested -= escapeLambda; + } + } + base._Notification(what); + } + + /// <summary> /// Método executa aproximadamente 60 vezes por segundo. /// </summary> |
