52 lines
1.1 KiB
GDScript
52 lines
1.1 KiB
GDScript
extends CanvasLayer
|
|
|
|
var pause = false : set = set_pause
|
|
|
|
func _ready():
|
|
hide()
|
|
|
|
func set_pause(p):
|
|
if p != pause:
|
|
if p:
|
|
%AnimationPlayer.play("pause")
|
|
else:
|
|
%AnimationPlayer.play_backwards("pause")
|
|
pause = p
|
|
get_tree().paused = pause
|
|
%Settings.close_settings()
|
|
%Controls.close_controls()
|
|
if p :
|
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
elif SceneManager.actual_scene.mouse_captured:
|
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
|
|
if p:
|
|
%GiveUp.visible = GameInfo.game_data and GameInfo.game_data.current_region_data
|
|
|
|
if not p:
|
|
GameInfo.save_settings()
|
|
|
|
func _input(_event):
|
|
if Input.is_action_just_pressed("pause"):
|
|
pause = not pause
|
|
|
|
func _on_resume_pressed():
|
|
pause = false
|
|
|
|
func _on_quit_pressed():
|
|
get_tree().quit()
|
|
|
|
func _on_game_gui_pause_asked():
|
|
pause = true
|
|
|
|
func _on_settings_pressed():
|
|
%Settings.open_settings()
|
|
|
|
func _on_controls_pressed():
|
|
%Controls.open_controls()
|
|
|
|
func _on_give_up_pressed():
|
|
if GameInfo.game_data:
|
|
SceneManager.change_to_scene_id('ASTRA')
|
|
GameInfo.game_data.give_up()
|