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

31 lines
554 B
C#
Raw Normal View History

2025-01-03 12:09:23 +00:00
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++;
}
}
}