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

39 lines
694 B
C#
Raw Normal View History

2024-05-12 17:03:20 +00:00
using Godot;
namespace Rokojori
{
[GlobalClass]
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;
[Export]
public string message;
2024-05-19 15:59:41 +00:00
[Export]
2025-01-08 18:46:17 +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();
2024-05-12 17:03:20 +00:00
2024-05-19 15:59:41 +00:00
var eventID = TimeLineScheduler.ScheduleEventIn( timeLine, duration,
( eventID ) =>
{
RJLog.Log( ">> delay ended", Time.GetTicksMsec(), sequenceID, eventID );
DispatchEnd( sequenceID );
2024-05-12 17:03:20 +00:00
2024-05-19 15:59:41 +00:00
}
);
2024-05-12 17:03:20 +00:00
2024-05-19 15:59:41 +00:00
RJLog.Log( ">> delay started", Time.GetTicksMsec(), sequenceID, eventID );
2024-05-12 17:03:20 +00:00
}
2024-05-19 15:59:41 +00:00
2024-05-12 17:03:20 +00:00
}
}