mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
3D Boss scripts implementation
This commit is contained in:
parent
b0d0161ab0
commit
dbf7f1a963
29 changed files with 1805 additions and 1188 deletions
47
Scripts/AttackPatterns/WaitPattern.cs
Normal file
47
Scripts/AttackPatterns/WaitPattern.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/AttackPatterns/WaitPattern.cs.uid
Normal file
1
Scripts/AttackPatterns/WaitPattern.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cg7gi3tva4gvw
|
||||
Loading…
Add table
Add a link
Reference in a new issue