From 862b399fa37e6ca692d38177a22ee34860d2251e Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 15 Sep 2025 20:00:47 -0300 Subject: Menu principal --- scripts/InputHandling/CastSpellInputHandler.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'scripts/InputHandling/CastSpellInputHandler.cs') 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 -- cgit v1.2.3