mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 20:35:53 +00:00
End of dialogue interaction
This commit is contained in:
parent
1fa77f0c03
commit
401d944ab4
3 changed files with 34 additions and 2 deletions
|
|
@ -6,6 +6,8 @@ public partial class DialogueStarter : Activable
|
|||
{
|
||||
|
||||
[Export] private string _trackName = "timeline";
|
||||
|
||||
[Export] private Node2D _dialogueEndActivationTarget;
|
||||
|
||||
private Node _dialogic;
|
||||
|
||||
|
|
@ -14,6 +16,13 @@ public partial class DialogueStarter : Activable
|
|||
base._Ready();
|
||||
|
||||
_dialogic = GetNode("/root/Dialogic");
|
||||
|
||||
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||
}
|
||||
|
||||
private void OnTimelineEnded()
|
||||
{
|
||||
DialogueEndAction();
|
||||
}
|
||||
|
||||
public override void Activate()
|
||||
|
|
@ -24,4 +33,19 @@ public partial class DialogueStarter : Activable
|
|||
// AddChild(dialog);
|
||||
//if (Dialogic)
|
||||
}
|
||||
|
||||
private bool DialogueEndAction()
|
||||
{
|
||||
if (_dialogueEndActivationTarget is not IActivable target)
|
||||
{
|
||||
GD.PrintErr($"Target {_dialogueEndActivationTarget.Name} is not activable");
|
||||
return false;
|
||||
}
|
||||
|
||||
target?.Activate();
|
||||
|
||||
GD.Print($"{_dialogueEndActivationTarget.Name} activated");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,11 @@ public partial class AreaTrigger : Area2D
|
|||
|
||||
if (OneTime && _activations > 0) return false;
|
||||
|
||||
if (Target is not IActivable target) return false;
|
||||
if (Target is not IActivable target)
|
||||
{
|
||||
GD.PrintErr($"Target {Target.Name} is not activable");
|
||||
return false;
|
||||
}
|
||||
target.Activate();
|
||||
|
||||
_activations++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue