add game completion handling and menu navigation
This commit is contained in:
@@ -13,7 +13,9 @@ public partial class GameManager : Node
|
||||
|
||||
[Export] private Control _winScreen;
|
||||
[Export] private Control _loseScreen;
|
||||
[Export] private Control _gameCompleteScreen;
|
||||
[Export] private Label _dayLabel;
|
||||
[Export] private PackedScene _mainMenuScene;
|
||||
|
||||
private int _currentDayIndex = 0;
|
||||
private Node _currentMiniGame;
|
||||
@@ -21,7 +23,7 @@ public partial class GameManager : Node
|
||||
public override void _Ready()
|
||||
{
|
||||
EventBus.OnLiftCompleted += HandleLiftResult;
|
||||
StartDay(_currentDayIndex);
|
||||
CallDeferred(nameof(StartDay), _currentDayIndex);
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
@@ -34,7 +36,16 @@ public partial class GameManager : Node
|
||||
if (index >= _days.Count)
|
||||
{
|
||||
GD.Print("YOU BEAT THE GYM! ALL DAYS COMPLETE.");
|
||||
// TODO: Show "Game Complete" screen
|
||||
_currentMiniGame?.QueueFree();
|
||||
_hazardSystem.ClearHazards();
|
||||
|
||||
if (_winScreen != null) _winScreen.Visible = false;
|
||||
if (_loseScreen != null) _loseScreen.Visible = false;
|
||||
|
||||
if (_gameCompleteScreen != null)
|
||||
{
|
||||
_gameCompleteScreen.Visible = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,18 +79,33 @@ public partial class GameManager : Node
|
||||
{
|
||||
GD.Print("Day Complete! Next day loading...");
|
||||
if (_winScreen != null) _winScreen.Visible = true;
|
||||
|
||||
// Wait for player input to proceed, or auto-load after delay
|
||||
// For now, let's auto-advance after 3 seconds for the prototype
|
||||
GetTree().CreateTimer(3.0f).Timeout += () => NextDay();
|
||||
}
|
||||
else
|
||||
{
|
||||
GD.Print("FAIL! Go home.");
|
||||
if (_loseScreen != null) _loseScreen.Visible = true;
|
||||
|
||||
// Restart day after delay
|
||||
GetTree().CreateTimer(3.0f).Timeout += () => RestartDay();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNextDayPressed()
|
||||
{
|
||||
NextDay();
|
||||
}
|
||||
|
||||
public void OnRetryPressed()
|
||||
{
|
||||
RestartDay();
|
||||
}
|
||||
|
||||
public void OnMenuPressed()
|
||||
{
|
||||
if (_mainMenuScene != null)
|
||||
{
|
||||
GetTree().ChangeSceneToPacked(_mainMenuScene);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user