2024-05-12 17:03:20 +00:00
|
|
|
|
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
|
2026-05-22 12:25:02 +00:00
|
|
|
using Rokojori.Extensions;
|
2024-05-12 17:03:20 +00:00
|
|
|
namespace Rokojori
|
|
|
|
|
{
|
2026-05-22 12:25:02 +00:00
|
|
|
[RokojoriActionCoreExport]
|
2025-11-26 14:23:59 +00:00
|
|
|
[Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/Delay.svg")]
|
2025-01-08 18:46:17 +00:00
|
|
|
public partial class Delay : SequenceAction
|
2024-05-12 17:03:20 +00:00
|
|
|
{
|
|
|
|
|
[Export]
|
|
|
|
|
public float duration;
|
|
|
|
|
|
2024-05-19 15:59:41 +00:00
|
|
|
[Export]
|
2026-05-22 12:25:02 +00:00
|
|
|
public Timeline timeLine;
|
2024-05-19 15:59:41 +00:00
|
|
|
|
2024-05-12 17:03:20 +00:00
|
|
|
|
2025-01-08 18:46:17 +00:00
|
|
|
protected override void _OnTrigger()
|
2024-05-12 17:03:20 +00:00
|
|
|
{
|
2024-05-19 15:59:41 +00:00
|
|
|
var sequenceID = DispatchStart();
|
2025-12-10 14:17:07 +00:00
|
|
|
|
|
|
|
|
// this.LogInfo( "time:", Time.GetTicksMsec() / 1000f );
|
2024-05-12 17:03:20 +00:00
|
|
|
|
2025-12-10 14:17:07 +00:00
|
|
|
if ( Engine.IsEditorHint() )
|
|
|
|
|
{
|
2026-05-22 12:25:02 +00:00
|
|
|
TimelineManager.ScheduleSpanIn(timeLine, 0, duration,
|
2025-12-10 14:17:07 +00:00
|
|
|
( span, type )=>
|
|
|
|
|
{
|
2026-05-22 12:25:02 +00:00
|
|
|
if ( type == TimelineSpanUpdateType.End )
|
2025-12-10 14:17:07 +00:00
|
|
|
{
|
|
|
|
|
DispatchEnd( sequenceID );
|
2026-05-25 10:31:21 +00:00
|
|
|
// this.LogInfo( "time:", Godot.Time.GetTicksMsec() / 1000f );
|
2025-12-10 14:17:07 +00:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2026-05-22 12:25:02 +00:00
|
|
|
var eventID = TimelineManager.ScheduleEventIn( timeLine, duration,
|
2025-12-10 14:17:07 +00:00
|
|
|
( tle ) =>
|
|
|
|
|
{
|
|
|
|
|
DispatchEnd( sequenceID );
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
this
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-05-19 15:59:41 +00:00
|
|
|
|
2024-05-12 17:03:20 +00:00
|
|
|
}
|
2024-05-19 15:59:41 +00:00
|
|
|
|
|
|
|
|
|
2024-05-12 17:03:20 +00:00
|
|
|
}
|
|
|
|
|
}
|