mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-20 01:53:47 +00:00
End of dialogue interaction
This commit is contained in:
parent
1fa77f0c03
commit
401d944ab4
3 changed files with 34 additions and 2 deletions
|
|
@ -109,6 +109,9 @@ position = Vector2(-1048, 184)
|
||||||
[node name="Door_vertical2" parent="Factory Tilemaps" instance=ExtResource("15_mgtvp")]
|
[node name="Door_vertical2" parent="Factory Tilemaps" instance=ExtResource("15_mgtvp")]
|
||||||
position = Vector2(-840, 184)
|
position = Vector2(-840, 184)
|
||||||
|
|
||||||
|
[node name="Door_vertical3" parent="Factory Tilemaps" instance=ExtResource("15_mgtvp")]
|
||||||
|
position = Vector2(-839, -120)
|
||||||
|
|
||||||
[node name="HorizontalDoor" parent="Factory Tilemaps" instance=ExtResource("12_i7i2m")]
|
[node name="HorizontalDoor" parent="Factory Tilemaps" instance=ExtResource("12_i7i2m")]
|
||||||
position = Vector2(-1120, 128)
|
position = Vector2(-1120, 128)
|
||||||
|
|
||||||
|
|
@ -199,7 +202,8 @@ position = Vector2(-772, -127)
|
||||||
Target = NodePath("../DialogueStarter")
|
Target = NodePath("../DialogueStarter")
|
||||||
OneTime = true
|
OneTime = true
|
||||||
|
|
||||||
[node name="DialogueStarter" type="Node2D" parent="."]
|
[node name="DialogueStarter" type="Node2D" parent="." node_paths=PackedStringArray("_dialogueEndActivationTarget")]
|
||||||
script = ExtResource("29_pvkri")
|
script = ExtResource("29_pvkri")
|
||||||
|
_dialogueEndActivationTarget = NodePath("../Factory Tilemaps/Door_vertical3")
|
||||||
|
|
||||||
[editable path="Factory Tilemaps/Camera"]
|
[editable path="Factory Tilemaps/Camera"]
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ public partial class DialogueStarter : Activable
|
||||||
{
|
{
|
||||||
|
|
||||||
[Export] private string _trackName = "timeline";
|
[Export] private string _trackName = "timeline";
|
||||||
|
|
||||||
|
[Export] private Node2D _dialogueEndActivationTarget;
|
||||||
|
|
||||||
private Node _dialogic;
|
private Node _dialogic;
|
||||||
|
|
||||||
|
|
@ -14,6 +16,13 @@ public partial class DialogueStarter : Activable
|
||||||
base._Ready();
|
base._Ready();
|
||||||
|
|
||||||
_dialogic = GetNode("/root/Dialogic");
|
_dialogic = GetNode("/root/Dialogic");
|
||||||
|
|
||||||
|
_dialogic.Connect("timeline_ended", Callable.From(OnTimelineEnded));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTimelineEnded()
|
||||||
|
{
|
||||||
|
DialogueEndAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Activate()
|
public override void Activate()
|
||||||
|
|
@ -24,4 +33,19 @@ public partial class DialogueStarter : Activable
|
||||||
// AddChild(dialog);
|
// AddChild(dialog);
|
||||||
//if (Dialogic)
|
//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 (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();
|
target.Activate();
|
||||||
|
|
||||||
_activations++;
|
_activations++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue