37 lines
928 B
C#
37 lines
928 B
C#
using Godot;
|
|
using Mr.BrickAdventures;
|
|
using Mr.BrickAdventures.Autoloads;
|
|
|
|
namespace Mr.BrickAdventures.scripts.UI;
|
|
|
|
public partial class GameOverScreen : Control
|
|
{
|
|
[Export] public Control GameOverPanel { get; set; }
|
|
[Export] public Button RestartButton { get; set; }
|
|
[Export] public Button MainMenuButton { get; set; }
|
|
[Export] public PackedScene MainMenuScene { get; set; }
|
|
|
|
public override void _Ready()
|
|
{
|
|
RestartButton.Pressed += OnRestartClicked;
|
|
MainMenuButton.Pressed += OnMainMenuClicked;
|
|
}
|
|
|
|
private void OnMainMenuClicked()
|
|
{
|
|
GameStateStore.Instance?.ResetAll();
|
|
GetTree().ChangeSceneToPacked(MainMenuScene);
|
|
}
|
|
|
|
private void OnRestartClicked()
|
|
{
|
|
GameManager.Instance?.RestartGame();
|
|
}
|
|
|
|
public void OnPlayerDeath()
|
|
{
|
|
if (GameStateStore.Instance?.Player.Lives != 0) return;
|
|
|
|
GameOverPanel.Show();
|
|
}
|
|
} |