32 lines
591 B
C#
32 lines
591 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class PauseMenu : Control
|
|
{
|
|
private static PauseMenu Instance;
|
|
public override void _Ready()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
public void Continue()
|
|
{
|
|
Visible = false;
|
|
GetTree().Paused = false;
|
|
}
|
|
public void Restart()
|
|
{
|
|
GetTree().Paused = false;
|
|
GetTree().ReloadCurrentScene();
|
|
}
|
|
public void Exit()
|
|
{
|
|
GetNode<AudioStreamPlayer>("Audio").Play();
|
|
GetNode<AudioStreamPlayer>("Audio").Finished += () => { GetTree().Quit(); };
|
|
}
|
|
public static void Pause()
|
|
{
|
|
Instance.Visible = true;
|
|
Instance.GetTree().Paused = true;
|
|
}
|
|
}
|