Refactor game state management to use a unified Stat system and update UI labels for production and corruption

This commit is contained in:
2025-08-23 02:44:54 +02:00
parent 2998e4c02a
commit 18312671d7
23 changed files with 298 additions and 109 deletions

View File

@@ -35,7 +35,7 @@ public partial class GameBus : Node
_gameLogic.UpdateGameState(_gameState, delta);
StateChanged?.Invoke(_gameState);
if (_gameState.Corruption >= 100)
if (_gameState.Get(Stat.Corruption) >= 100)
{
GD.Print("The world has died!");
GetTree().Quit(); // For now
@@ -73,4 +73,9 @@ public partial class GameBus : Node
}
}
}
public void SubscribeToStat(Stat stat, Action<double> listener) => _gameState.Subscribe(stat, listener);
public void UnsubscribeFromStat(Stat stat, Action<double> listener) => _gameState.Unsubscribe(stat, listener);
public GameState CurrentState => _gameState;
}