mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 03:05:54 +00:00
Moved boss data to resource
This commit is contained in:
parent
c0bd2f6824
commit
b0d5edc84e
6 changed files with 27 additions and 23 deletions
|
|
@ -12,7 +12,7 @@ public partial class Boss : Enemy, IActivable
|
|||
[Export] public string BossName { get; private set; }
|
||||
//[Export] private Array<BossPhase> Phases;
|
||||
[Export] public BossScript BossScript { get; private set; }
|
||||
[Export] private PackedScene BossHudPrefab;
|
||||
//[Export] private PackedScene BossHudPrefab;
|
||||
[Export] public Vector2 BossPhaseAnimationStartingPosition = new Vector2(180, 10);
|
||||
|
||||
private int currentPhaseIndex = 0;
|
||||
|
|
@ -33,8 +33,7 @@ public partial class Boss : Enemy, IActivable
|
|||
|
||||
private TextureRect _animationTextureRect;
|
||||
|
||||
[Export]
|
||||
private Texture2D _bossPortraitTexture;
|
||||
//[Export] private Texture2D _bossPortraitTexture;
|
||||
|
||||
private BossHud _bossHud;
|
||||
|
||||
|
|
@ -55,9 +54,9 @@ public partial class Boss : Enemy, IActivable
|
|||
_gameManager.CallDeferred("add_child", _cameraMarker);
|
||||
_cameraMarker.GlobalPosition = _homePosition + CameraOffset;
|
||||
|
||||
if (BossHudPrefab is not null)
|
||||
if (BossScript.HudPrefab is not null)
|
||||
{
|
||||
_bossHud = BossHudPrefab.Instantiate<BossHud>();
|
||||
_bossHud = BossScript.HudPrefab.Instantiate<BossHud>();
|
||||
_gameManager.CallDeferred("add_child", _bossHud);
|
||||
|
||||
_bossHud.Name = $"{BossName}_BossHud";
|
||||
|
|
@ -70,7 +69,7 @@ public partial class Boss : Enemy, IActivable
|
|||
// TODO: Do some translation for health values to match the thresholds
|
||||
this.HealthChanged += (float newValue) => {_bossHud.BossHealth = newValue;};
|
||||
|
||||
if (_bossPortraitTexture is not null)
|
||||
if (BossScript.PortraitTexture is not null)
|
||||
{
|
||||
// var canvas = new CanvasLayer();
|
||||
// canvas.Name = "BossPhaseAnimationCanvas";
|
||||
|
|
@ -78,7 +77,7 @@ public partial class Boss : Enemy, IActivable
|
|||
// _gameManager.CallDeferred("add_child", canvas);
|
||||
|
||||
_animationTextureRect = new TextureRect();
|
||||
_animationTextureRect.Texture = _bossPortraitTexture;
|
||||
_animationTextureRect.Texture = BossScript.PortraitTexture;
|
||||
|
||||
_bossHud.CallDeferred("add_child", _animationTextureRect);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,15 @@ namespace Cirno.Scripts.Resources.ScriptableBullets;
|
|||
[GlobalClass]
|
||||
public partial class BossScript : Resource
|
||||
{
|
||||
[Export]
|
||||
public StringName BossName { get; private set; }
|
||||
|
||||
[Export]
|
||||
public Array<BossPhase> Phases { get; private set; } = [];
|
||||
|
||||
[Export]
|
||||
public Texture2D PortraitTexture { get; private set; }
|
||||
|
||||
[Export]
|
||||
public PackedScene HudPrefab { get; private set; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue