mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:05:34 +00:00
37 lines
No EOL
990 B
C#
37 lines
No EOL
990 B
C#
using Cirno.Scripts.Actors;
|
|
using Godot;
|
|
using Godot.Collections;
|
|
|
|
namespace Cirno.Scripts.Resources;
|
|
|
|
[GlobalClass]
|
|
public partial class BossPhase : Resource
|
|
{
|
|
[Export] public string PhaseName = string.Empty;
|
|
[Export] public int Threshold;
|
|
[Export] public bool PlayAnimation;
|
|
[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.Parent);
|
|
}
|
|
}
|
|
} |