37 lines
746 B
C#
37 lines
746 B
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class PauseManager : Node
|
|
{
|
|
[Export] private CanvasLayer _hud;
|
|
[Export] private CanvasLayer _pauseMenu;
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (Input.IsActionJustPressed("pause"))
|
|
{
|
|
bool paused = GetTree().Paused;
|
|
if (!paused)
|
|
{
|
|
PauseGame();
|
|
return;
|
|
}
|
|
ContinueGame();
|
|
}
|
|
}
|
|
|
|
public void PauseGame()
|
|
{
|
|
GetTree().Paused = true;
|
|
_hud.Visible = false;
|
|
_pauseMenu.Visible = true;
|
|
}
|
|
|
|
public void ContinueGame()
|
|
{
|
|
GetTree().Paused = false;
|
|
_hud.Visible = true;
|
|
_pauseMenu.Visible = false;
|
|
}
|
|
}
|