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

31 lines
550 B
C#
Raw Normal View History

2025-01-03 12:09:23 +00:00
using Godot;
namespace Rokojori
{
[GlobalClass ]
2025-01-08 18:46:17 +00:00
public partial class IterateActions : Action
2025-01-03 12:09:23 +00:00
{
[ExportGroup( "Read Only")]
[Export]
public int iterationIndex = 0;
2025-01-08 18:46:17 +00:00
protected override void _OnTrigger()
2025-01-03 12:09:23 +00:00
{
2025-01-08 18:46:17 +00:00
var num = this.NumDirectChildrenOf<Action>();
2025-01-03 12:09:23 +00:00
if ( num == 0 )
{
iterationIndex = 0;
return;
}
iterationIndex = MathX.Repeat( iterationIndex, num );
2025-01-08 18:46:17 +00:00
Action.Trigger( this.GetNthDirectChild<Action>( iterationIndex ) );
2025-01-03 12:09:23 +00:00
iterationIndex++;
}
}
}