mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
38 lines
699 B
C#
38 lines
699 B
C#
|
|
using System.Threading.Tasks;
|
|||
|
|
using Godot;
|
|||
|
|
|
|||
|
|
namespace Cirno.Scripts.Resources.Events;
|
|||
|
|
|
|||
|
|
[GlobalClass]
|
|||
|
|
public partial class WaitEvent : EventResource
|
|||
|
|
{
|
|||
|
|
[Export(PropertyHint.None, "suffix:s")]
|
|||
|
|
public float WaitTime { get; set; }
|
|||
|
|
protected bool _isComplete = false;
|
|||
|
|
|
|||
|
|
public override void Init(Node2D parent)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Start(Node2D parent)
|
|||
|
|
{
|
|||
|
|
_ = Wait();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private async Task Wait()
|
|||
|
|
{
|
|||
|
|
await Task.Delay((int)(WaitTime)*1000);
|
|||
|
|
_isComplete = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void UpdateEvent(double delta)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsComplete()
|
|||
|
|
{
|
|||
|
|
return _isComplete;
|
|||
|
|
}
|
|||
|
|
}
|