Added Player Framework and some commands

This commit is contained in:
2026-04-06 13:47:06 +02:00
parent 22108bb58d
commit 2fca1281a7
19 changed files with 333 additions and 2 deletions
+30 -1
View File
@@ -1,10 +1,14 @@
using Godot;
using System;
using System.Collections.Generic;
using TextRPG.Commands; // Add this to access ConsoleManager
using TextRPG.Commands;
using TextRPG.PlayerSystem;
public partial class ConsoleUI : CanvasLayer
{
private Player player;
// UI Elements
private RichTextLabel consoleOutput;
private LineEdit consoleInput;
@@ -58,6 +62,31 @@ public partial class ConsoleUI : CanvasLayer
// Display welcome message
DisplayWelcomeMessage();
player = GetNode<Player>("/root/Player");
if (player != null)
{
player.HealthChanged += OnPlayerHealthChanged;
player.PlayerDied += OnPlayerDied;
player.InventoryChanged += OnInventoryChanged;
}
}
private void OnPlayerHealthChanged(int current, int max)
{
AddToConsole($"[color=orange]Health changed: {current}/{max}[/color]");
}
private void OnPlayerDied()
{
AddToConsole("[color=red]You have died... Game Over.[/color]");
// Optionally disable input or reload
}
private void OnInventoryChanged()
{
// Optional: show a subtle message or nothing – you decide
// AddToConsole("[dim]Inventory updated.[/dim]");
}
private void SetupConsole()