SupaLidlGame/Characters/Boss.cs

51 lines
1.1 KiB
C#

using Godot;
using GodotUtilities;
namespace SupaLidlGame.Characters;
public abstract partial class Boss : Enemy
{
[Export]
public State.NPC.NPCStateMachine BossStateMachine { get; set; }
[Export]
public string BossName { get; set; }
[Export]
public AudioStream Music { get; set; }
public abstract int Intensity { get; }
private bool _isActive;
[Export]
public virtual bool IsActive
{
get => _isActive;
set
{
_isActive = value;
// register or deregister ourselves when we are active/inactive
this.GetAncestor<Utils.World>()
.RegisterBoss(_isActive ? this : null);
}
}
public override void _Ready()
{
base._Ready();
Death += (Events.HealthChangedArgs args) =>
{
UpdateBossStatus(true);
};
}
protected void UpdateBossStatus(bool status)
{
GetNode<State.Global.GlobalState>("/root/GlobalState")
.Progression.BossStatus[SceneFilePath] = status;
}
}