mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Boss script resource
This commit is contained in:
parent
97027ddc33
commit
c0bd2f6824
11 changed files with 62 additions and 17 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Threading.Tasks;
|
||||
using Cirno.Scripts.Resources;
|
||||
using Cirno.Scripts.Resources.ScriptableBullets;
|
||||
using Cirno.Scripts.UI;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
|
@ -9,7 +10,8 @@ namespace Cirno.Scripts.Actors;
|
|||
public partial class Boss : Enemy, IActivable
|
||||
{
|
||||
[Export] public string BossName { get; private set; }
|
||||
[Export] private Array<BossPhase> Phases;
|
||||
//[Export] private Array<BossPhase> Phases;
|
||||
[Export] public BossScript BossScript { get; private set; }
|
||||
[Export] private PackedScene BossHudPrefab;
|
||||
[Export] public Vector2 BossPhaseAnimationStartingPosition = new Vector2(180, 10);
|
||||
|
||||
|
|
@ -22,7 +24,7 @@ public partial class Boss : Enemy, IActivable
|
|||
public GameManager GameManager => _gameManager;
|
||||
private Vector2 _homePosition;
|
||||
public Vector2 HomePosition => _homePosition;
|
||||
private BossPhase CurrentPhase => Phases[currentPhaseIndex];
|
||||
private BossPhase CurrentPhase => BossScript.Phases[currentPhaseIndex];
|
||||
|
||||
private Marker2D _cameraMarker;
|
||||
|
||||
|
|
@ -39,6 +41,12 @@ public partial class Boss : Enemy, IActivable
|
|||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
if (BossScript is null)
|
||||
{
|
||||
GD.PrintErr($"No boss script defined in {this.Name}");
|
||||
return;
|
||||
}
|
||||
|
||||
_gameManager = this.GetGameManager();
|
||||
|
||||
_homePosition = this.GlobalPosition;
|
||||
|
|
@ -90,7 +98,7 @@ public partial class Boss : Enemy, IActivable
|
|||
if (_waiting) return;
|
||||
|
||||
CurrentPhase.UpdatePhase(delta);
|
||||
if (_currentHealth <= CurrentPhase.Threshold && currentPhaseIndex + 1 < Phases.Count)
|
||||
if (_currentHealth <= CurrentPhase.Threshold && currentPhaseIndex + 1 < BossScript.Phases.Count)
|
||||
{
|
||||
currentPhaseIndex++;
|
||||
_bossHud.SpellCardName = CurrentPhase.PhaseName;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue