Added Player Framework and some commands
This commit is contained in:
+30
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user