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

46 lines
843 B
C#
Raw Normal View History

2024-05-04 08:26:16 +00:00
using Godot;
namespace Rokojori
{
2024-05-08 07:19:48 +00:00
[GlobalClass, Icon("res://Scripts/Rokojori/Rokojori-Action-Library/Icons/RJActionList.svg") ]
2024-05-04 08:26:16 +00:00
public partial class ActionList : RJAction
{
[Export]
public RJAction[] actions;
[Export]
public bool triggerDirectChildren = true;
2024-05-05 07:52:06 +00:00
public override void _OnTrigger()
2024-05-04 08:26:16 +00:00
{
2024-05-05 07:52:06 +00:00
if ( actions != null )
{
for ( int i = 0; i < actions.Length; i++ )
{
Actions.Trigger( actions[ i ] );
}
}
2024-05-04 08:26:16 +00:00
2024-05-05 07:52:06 +00:00
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 );
}
2024-05-04 08:26:16 +00:00
}
}
}