Patterns tweaks

This commit is contained in:
Marco 2025-02-13 11:59:51 +01:00
commit a430554e27
7 changed files with 69 additions and 22 deletions

View file

@ -21,6 +21,11 @@ public partial class Boss : Enemy, IActivable
public Vector2 HomePosition => _homePosition;
private BossPhase CurrentPhase => Phases[currentPhaseIndex];
private Marker2D _cameraMarker;
[Export]
public Vector2 CameraOffset = Vector2.Zero;
// [Export]
// private PackedScene _bossPhaseAnimationPrefab;
@ -37,12 +42,17 @@ public partial class Boss : Enemy, IActivable
_gameManager = this.GetGameManager();
_homePosition = this.GlobalPosition;
_cameraMarker = new Marker2D();
_gameManager.CallDeferred("add_child", _cameraMarker);
_cameraMarker.GlobalPosition = _homePosition + CameraOffset;
if (BossHudPrefab is not null)
{
_bossHud = BossHudPrefab.Instantiate<BossHud>();
_gameManager.CallDeferred("add_child", _bossHud);
_bossHud.Visible = false;
_bossHud.BossName = BossName;
_bossHud.BossMaxHealth = this.Health;
_bossHud.BossHealth = this._currentHealth;
@ -117,6 +127,11 @@ public partial class Boss : Enemy, IActivable
public void Activate(ActivationType activationType = ActivationType.Toggle)
{
_started = true;
if (_bossHud is not null)
{
_bossHud.Visible = true;
}
_gameManager.CameraTargetObject(_cameraMarker);
StartPhase(CurrentPhase);
}