62 lines
1.3 KiB
C#
62 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[GlobalClass]
|
|
[ScriptPath("res://Scripts/Actions/PlayDialogue.cs")]
|
|
public partial class PlayDialogue : IBehaviour
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
private string id;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private bool isEvent;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private bool facePlayer = true;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity.Animations anim = Entity.Animations.None;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private NodePath eventCaller;
|
|
|
|
public override void Do()
|
|
{
|
|
if (TextSystem.instance.Visible)
|
|
{
|
|
return;
|
|
}
|
|
Coroutine inEvent = Main.inEvent;
|
|
if ((inEvent == null || inEvent.done) && !(Player.instance.inputCD > 0f))
|
|
{
|
|
base.parent.StopMoving();
|
|
if (facePlayer)
|
|
{
|
|
base.parent.LookAt(Player.instance.GlobalPosition);
|
|
}
|
|
Player.instance.CallDeferred("PartyStop");
|
|
if (!isEvent)
|
|
{
|
|
TextSystem.caller = base.parent;
|
|
TextSystem.GetText(id);
|
|
TextSystem.instance.DiagEnd += DiagEnd;
|
|
}
|
|
else
|
|
{
|
|
base.parent.GetNode(eventCaller).EmitSignal(EventCaller.SignalName.DoEvent);
|
|
}
|
|
base.parent.current = null;
|
|
}
|
|
}
|
|
|
|
public void DiagEnd()
|
|
{
|
|
TextSystem.instance.DiagEnd -= DiagEnd;
|
|
base.parent.current = null;
|
|
}
|
|
|
|
}
|