✨ Added VariableGetter functionality and some Variable setting components. Also added them to test scene.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user