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

46 lines
843 B
C#

using Godot;
namespace Rokojori
{
[GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJActionList.svg") ]
public partial class ActionList : RJAction
{
[Export]
public RJAction[] actions;
[Export]
public bool triggerDirectChildren = true;
public override void _OnTrigger()
{
if ( actions != null )
{
for ( int i = 0; i < actions.Length; i++ )
{
Actions.Trigger( actions[ i ] );
}
}
if ( ! triggerDirectChildren )
{
return;
}
var childCount = GetChildCount();
for ( int i = 0; i < childCount; i++ )
{
var action = GetChild( i ) as RJAction;
if ( action == null )
{
continue;
}
Actions.Trigger( action );
}
}
}
}