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

39 lines
973 B
C#
Raw Normal View History

2024-05-04 08:26:16 +00:00
using Godot;
namespace Rokojori
{
2024-05-12 17:03:20 +00:00
/** <summary for="class ActionList">
<title>
2025-01-08 18:46:17 +00:00
Executes multiple actions (Action) at once.
2024-05-12 17:03:20 +00:00
</title>
<description>
2025-01-08 18:46:17 +00:00
The ActionList, which is an Action itself, executes all actions stored in the member 'actions' and also child nodes
that extend Action, when 'triggerDirectChildren' is checked.
2024-05-12 17:03:20 +00:00
</description>
</summary>
*/
2025-01-08 18:46:17 +00:00
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ActionList.svg") ]
public partial class ActionList : Action
2024-05-12 17:03:20 +00:00
{
/** <summary for="field actions">Actions to execute</summary>*/
2024-05-04 08:26:16 +00:00
[Export]
2025-01-08 18:46:17 +00:00
public Action[] actions;
2024-05-12 17:03:20 +00:00
2025-01-08 18:46:17 +00:00
/** <summary for="field triggerDirectChildren">Whether to execute Action child nodes</summary>*/
2024-05-12 17:03:20 +00:00
[Export]
2024-05-04 08:26:16 +00:00
public bool triggerDirectChildren = true;
2025-01-08 18:46:17 +00:00
protected override void _OnTrigger()
2024-05-04 08:26:16 +00:00
{
2025-01-08 18:46:17 +00:00
Action.TriggerAll( actions, this, triggerDirectChildren );
2024-05-04 08:26:16 +00:00
}
}
}