mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:25:35 +00:00
47 lines
No EOL
1 KiB
C#
47 lines
No EOL
1 KiB
C#
using System.Threading.Tasks;
|
|
using Cirno.Scripts.Resources;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.AttackPatterns;
|
|
|
|
[GlobalClass]
|
|
[Tool]
|
|
public partial class WaitPattern : AttackPattern
|
|
{
|
|
[Export] public float SecondsToWait = 1f;
|
|
|
|
public override IPatternMachine MakeMachine(Node parent)
|
|
{
|
|
return new WaitPatternMachine(this, parent);
|
|
}
|
|
|
|
public class WaitPatternMachine(WaitPattern pattern, Node parent) : IPatternMachine
|
|
{
|
|
public Node Parent => parent;
|
|
private bool _isComplete = false;
|
|
protected IScriptHost3D Boss;
|
|
|
|
public void Start()
|
|
{
|
|
_isComplete = false;
|
|
_ = WaitAsync(pattern.SecondsToWait);
|
|
}
|
|
|
|
public void UpdatePattern(double delta)
|
|
{
|
|
|
|
}
|
|
|
|
private async Task WaitAsync(float time)
|
|
{
|
|
await Task.Delay((int)time * 1000);
|
|
|
|
_isComplete = true;
|
|
}
|
|
|
|
public bool IsComplete()
|
|
{
|
|
return _isComplete;
|
|
}
|
|
}
|
|
} |