rokojori_action_library/Runtime/Actions/OnProcess.cs

33 lines
765 B
C#
Raw Normal View History

2024-08-04 09:08:12 +00:00
using Godot;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
namespace Rokojori;
2024-08-04 09:08:12 +00:00
2026-05-22 12:25:02 +00:00
[RokojoriActionCoreExport]
[GlobalClass, Tool, Icon("res://addons/rokojori_action_library/Icons/OnEvent.svg") ]
public partial class OnProcess : Node
{
/** <summary for="field actions">Actions to execute</summary>*/
[Export]
public Action[] actions = new Action[ 0 ];
2024-08-04 09:08:12 +00:00
2026-05-22 12:25:02 +00:00
/** <summary for="field triggerDirectChildren">Whether to execute Action child nodes</summary>*/
[Export]
public bool triggerDirectChildren = true;
[Export]
public bool executeInEditor = false;
2024-08-04 09:08:12 +00:00
2026-05-22 12:25:02 +00:00
public override void _Process( double delta )
{
if ( Engine.IsEditorHint() && ! executeInEditor )
{
return;
2024-08-04 09:08:12 +00:00
}
2026-05-22 12:25:02 +00:00
Action.TriggerAllActions( actions, this, triggerDirectChildren );
2024-08-04 09:08:12 +00:00
}
2026-05-22 12:25:02 +00:00
}