Fix dying loop, add death counter, add die button to debug

This commit is contained in:
2026-01-20 21:18:10 -08:00
parent 670f8baabf
commit a1f67c3d71
16 changed files with 390 additions and 294 deletions

View File

@@ -12,6 +12,8 @@ public partial class PauseDebugMenu : Control, IDebugMenu
{
public override void _Notification(int what) => this.Notify(what);
[Dependency] private IGame _game => this.DependOn<IGame>();
[Dependency] private IMap _map => this.DependOn<IMap>(() => new Map());
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
@@ -24,6 +26,10 @@ public partial class PauseDebugMenu : Control, IDebugMenu
[Node] public Button LoadNextFloorButton { get; set; } = default!;
[Node] public Button DieButton { get; set; } = default!;
[Node] public Label DeathCount { get; set; } = default!;
private readonly string _floorFilePath = @"res://src/map/dungeon/floors/";
private readonly string _enemyFilePath = @"res://src/enemy/enemy_types";
@@ -35,6 +41,8 @@ public partial class PauseDebugMenu : Control, IDebugMenu
public override void _Ready()
{
LoadNextFloorButton.Pressed += LoadNextFloorButton_Pressed;
DieButton.Pressed += DieButton_Pressed;
VisibilityChanged += PauseDebugMenu_VisibilityChanged;
_itemDatabase = ItemDatabase.Instance;
_spawnableItems = _itemDatabase.Items;
@@ -79,6 +87,10 @@ public partial class PauseDebugMenu : Control, IDebugMenu
SpawnEnemyDropDown.ItemSelected += SpawnEnemyDropDown_ItemSelected;
}
private void DieButton_Pressed() => _player.Die();
private void PauseDebugMenu_VisibilityChanged() => DeathCount.Text = _game.QuestData.DeathCount.ToString("D2");
private void FloorSelectDropDown_ItemSelected(long index)
{
var sceneName = FloorSelectDropDown.GetItemText((int)index);