summaryrefslogtreecommitdiff
path: root/scripts/InputHandling/CastSpellInputHandler.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-15 20:00:47 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-15 20:00:47 -0300
commit862b399fa37e6ca692d38177a22ee34860d2251e (patch)
tree3c0c80efbe0096c8e8d606ee464b54b55eaa209c /scripts/InputHandling/CastSpellInputHandler.cs
parentbefb39054656e3242e9408f2afe8c902df471ffa (diff)
Menu principal
Diffstat (limited to 'scripts/InputHandling/CastSpellInputHandler.cs')
-rw-r--r--scripts/InputHandling/CastSpellInputHandler.cs17
1 files changed, 16 insertions, 1 deletions
diff --git a/scripts/InputHandling/CastSpellInputHandler.cs b/scripts/InputHandling/CastSpellInputHandler.cs
index 1c5d005..904bfab 100644
--- a/scripts/InputHandling/CastSpellInputHandler.cs
+++ b/scripts/InputHandling/CastSpellInputHandler.cs
@@ -36,12 +36,15 @@ public partial class CastSpellInputHandler : BaseInputHandler
[Export]
private Map map;
+ SignalBus.PlayerSpellChooseLocationEventHandler spellLocationLambda;
+
public override void _Ready()
{
base._Ready();
+ spellLocationLambda = (SpellResource spell) => selectedSpell = spell;
// O jogador informa qual feitiço será usado.
- SignalBus.Instance.PlayerSpellChooseLocation += (SpellResource spell) => selectedSpell = spell;
+ SignalBus.Instance.PlayerSpellChooseLocation += spellLocationLambda;
}
public override void Enter()
@@ -90,4 +93,16 @@ public partial class CastSpellInputHandler : BaseInputHandler
return action;
}
+
+ public override void _Notification(int what)
+ {
+ if (what == NotificationPredelete)
+ {
+ if (spellLocationLambda != null)
+ {
+ SignalBus.Instance.PlayerSpellChooseLocation -= spellLocationLambda;
+ }
+ }
+ base._Notification(what);
+ }
} \ No newline at end of file