Separated events from variables and adjusted test scene

This commit is contained in:
2025-10-28 11:57:36 +01:00
parent 080ebaae47
commit c96e6da78e
16 changed files with 195 additions and 136 deletions
@@ -1,5 +1,6 @@
using System;
using Babushka.scripts.CSharp.Low_Code.Events;
using Babushka.scripts.CSharp.Low_Code.Variables;
using Godot;
@@ -13,23 +14,23 @@ public partial class VariantRandomizer : Node
/// <summary>
/// The event resource to work on.
/// </summary>
[Export] public EventResource _eventResource;
[Export] public VariableResource _variableResource;
/// <summary>
/// Sets the payload of a randomizable event resource to a random value.
/// </summary>
public void RandomizeEventResource()
{
switch (_eventResource.Payload.VariantType)
switch (_variableResource.Payload.VariantType)
{
case Variant.Type.Color:
_eventResource.Payload= GetRandomColor();
_variableResource.Payload= GetRandomColor();
break;
case Variant.Type.Int:
_eventResource.Payload= GetRandomInt();
_variableResource.Payload= GetRandomInt();
break;
case Variant.Type.Float:
_eventResource.Payload= GetRandomFloat();
_variableResource.Payload= GetRandomFloat();
break;
}
}