rj-action-library/Runtime/Actions/IterateActions.cs

31 lines
554 B
C#

using Godot;
namespace Rokojori
{
[GlobalClass ]
public partial class IterateActions : RJAction
{
[ExportGroup( "Read Only")]
[Export]
public int iterationIndex = 0;
public override void _OnTrigger()
{
var num = this.NumDirectChildrenOf<RJAction>();
if ( num == 0 )
{
iterationIndex = 0;
return;
}
iterationIndex = MathX.Repeat( iterationIndex, num );
Actions.Trigger( this.GetNthDirectChild<RJAction>( iterationIndex ) );
iterationIndex++;
}
}
}