summaryrefslogtreecommitdiff
path: root/scripts/Game.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Game.cs')
-rw-r--r--scripts/Game.cs21
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>