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

39 lines
695 B
C#
Raw Normal View History

2024-05-12 17:03:20 +00:00
using Godot;
namespace Rokojori
{
[GlobalClass]
public partial class Delay : RJSequenceAction
{
[Export]
public float duration;
[Export]
public string message;
2024-05-19 15:59:41 +00:00
[Export]
public RJTimeLine timeLine;
2024-05-12 17:03:20 +00:00
public override void _OnTrigger()
{
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
}
}