You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
900 B
30 lines
900 B
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Low_Code.Variables;
|
|
|
|
/// <summary>
|
|
/// An active getter component for calling the payload value of a <see cref="VariableResource"/>.
|
|
/// </summary>
|
|
public partial class VariableGetter : Node
|
|
{
|
|
/// <summary>
|
|
/// The event resource to listen to.
|
|
/// </summary>
|
|
[Export] private VariableResource _variableResource;
|
|
|
|
/// <summary>
|
|
/// A signal that is triggered when the payload of one of the <see cref="VariableResource"/> is called.
|
|
/// </summary>
|
|
[Signal] public delegate void GetPayloadEventHandler(Variant payload);
|
|
|
|
/// <summary>
|
|
/// Gets the Variant payload of a VariableResource on demand.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Variant Get()
|
|
{
|
|
Variant payload = _variableResource.Payload;
|
|
EmitSignal(SignalName.GetPayload, payload);
|
|
return payload;
|
|
}
|
|
} |