mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 04:05:54 +00:00
Danmaku system
This commit is contained in:
parent
9c8ec486fc
commit
fdec052c16
38 changed files with 924 additions and 9 deletions
35
Scripts/Resources/BossPhase.cs
Normal file
35
Scripts/Resources/BossPhase.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Cirno.Scripts.Actors;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Resources;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class BossPhase : Resource
|
||||
{
|
||||
[Export] public int Threshold;
|
||||
[Export] public Array<AttackPattern> Patterns;
|
||||
|
||||
private int currentPatternIndex = 0;
|
||||
private double patternTimer;
|
||||
|
||||
public void Start(Boss boss)
|
||||
{
|
||||
currentPatternIndex = 0;
|
||||
Patterns[currentPatternIndex].Start(boss);
|
||||
}
|
||||
|
||||
public void UpdatePhase(double delta)
|
||||
{
|
||||
patternTimer += delta;
|
||||
var currentPattern = Patterns[currentPatternIndex];
|
||||
|
||||
currentPattern.UpdatePattern(delta);
|
||||
|
||||
if (!currentPattern.WaitForCompletion || currentPattern.IsComplete())
|
||||
{
|
||||
currentPatternIndex = (currentPatternIndex + 1) % Patterns.Count;
|
||||
Patterns[currentPatternIndex].Start(currentPattern.Boss);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue