diff options
Diffstat (limited to 'scripts/InputHandling/CastSpellInputHandler.cs')
| -rw-r--r-- | scripts/InputHandling/CastSpellInputHandler.cs | 17 |
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 |
