using Godot; using Rokojori.Extensions; namespace Rokojori { [RokojoriActionCoreExport] [Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Delay.svg")] public partial class Delay : SequenceAction { [Export] public float duration; [Export] public Timeline timeLine; protected override void _OnTrigger() { var sequenceID = DispatchStart(); // this.LogInfo( "time:", Time.GetTicksMsec() / 1000f ); if ( Engine.IsEditorHint() ) { TimelineManager.ScheduleSpanIn(timeLine, 0, duration, ( span, type )=> { if ( type == TimelineSpanUpdateType.End ) { DispatchEnd( sequenceID ); // this.LogInfo( "time:", Godot.Time.GetTicksMsec() / 1000f ); } }, this ); } else { var eventID = TimelineManager.ScheduleEventIn( timeLine, duration, ( tle ) => { DispatchEnd( sequenceID ); }, this ); } } } }