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

53 lines
1000 B
C#

using Godot;
namespace Rokojori
{
public class Actions
{
public static void Trigger( RJAction action )
{
if ( action == null )
{
return;
}
action.Trigger();
}
public static void TriggerAll( RJAction[] actions, Node target, bool triggerDirectChildren )
{
if ( actions != null )
{
for ( int i = 0; i < actions.Length; i++ )
{
Actions.Trigger( actions[ i ] );
}
}
if ( ! triggerDirectChildren )
{
return;
}
Nodes.ForEachDirectChild<RJAction>( target, a => Actions.Trigger( a ) );
}
public static void TriggerAll( RJAction action, Node target, bool triggerDirectChildren )
{
if ( action != null )
{
Actions.Trigger( action );
}
if ( ! triggerDirectChildren )
{
return;
}
Nodes.ForEachDirectChild<RJAction>( target, a => Actions.Trigger( a ) );
}
}
}