58 lines
937 B
C#
58 lines
937 B
C#
using Godot;
|
|
|
|
using Rokojori.Extensions;
|
|
namespace Rokojori;
|
|
|
|
[Tool]
|
|
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/OnStateActive.svg")]
|
|
public partial class OnStateActive:Sequence
|
|
{
|
|
|
|
[Export]
|
|
public bool isExclusive = true;
|
|
|
|
[Export]
|
|
public bool reinitialize = false;
|
|
|
|
public enum LoopMode
|
|
{
|
|
No_Loop,
|
|
Next_Frame,
|
|
Direct_Continuation
|
|
}
|
|
|
|
[Export]
|
|
public LoopMode loopMode = LoopMode.No_Loop;
|
|
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
|
|
onSequenceDone.AddAction( OnDone );
|
|
}
|
|
|
|
protected override void _OnTrigger()
|
|
{
|
|
// this.LogInfo( "Triggering" );
|
|
base._OnTrigger();
|
|
}
|
|
|
|
async void OnDone( SequenceActionFinishedEvent ev )
|
|
{
|
|
if ( LoopMode.No_Loop == loopMode )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if ( LoopMode.Next_Frame == loopMode )
|
|
{
|
|
await this.RequestNextFrame();
|
|
}
|
|
|
|
|
|
// this.LogInfo( "Loop Re-Triggering" );
|
|
Trigger();
|
|
|
|
}
|
|
}
|