1
0
Fork 0
mirror of https://github.com/tonytins/dressupzack synced 2025-05-07 14:04:48 -04:00
dressupzack/project/src/PauseScn.cs
Anthony Wilcox bb7d4c2d2c
Switch to C# (#8)
I learned C# primarily for game development but held off switching to it on Godot 3 because it was still rough around edges - crashed way too many times. It seems to be working as it should as of 3.1.1 and that's why I'm rewriting all the GDScript portions in C# as much as possible.

However, this does make it incompatible with the Steam version, as of this writing, until the Godot devs decide how they want to publish it in future updates.
2019-06-11 01:30:02 -04:00

43 lines
806 B
C#

using Godot;
public class PauseScn : Control
{
void IsGamePaused(bool isPaused)
{
if (isPaused)
GetTree().Paused = true;
else
GetTree().Paused = false;
}
public override void _Ready()
{
}
public override void _Process(float delta)
{
if (Input.IsActionPressed("ui_pause"))
{
GetNode<Popup>("PauseWin").Show();
IsGamePaused(true);
}
}
void _on_ExitBtn_pressed()
{
IsGamePaused(false);
GetTree().ChangeScene("res://scn/TitleScn.tscn");
}
void _on_SettingsBtn_pressed()
{
GetNode<Popup>("SettingsWin").Show();
}
void _on_ResumeBtn_pressed()
{
GetNode<Popup>("PauseWin").Hide();
IsGamePaused(false);
}
}