Refactored Menu state and added states for typing or AFK in the Enum

pull/50/head
unfa 2021-06-03 19:03:43 +02:00
parent 4ec9f7974c
commit 53c8ee86fd
1 changed files with 6 additions and 6 deletions

View File

@ -1,18 +1,18 @@
extends Node
enum Gamemode {IN_MENU, PLAYING}
enum GameFocus {IN_MENU, PLAYING, TYPING, AFK}
var mode = Gamemode.IN_MENU
var mode = GameFocus.IN_MENU
func _input(event) -> void:
if Input.is_action_just_pressed("ui_cancel"):
if mode == Gamemode.PLAYING:
if mode == GameFocus.PLAYING:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
$CanvasLayer/GUI.show()
$Level/Player.input_active = false
mode = Gamemode.IN_MENU
elif mode == Gamemode.IN_MENU:
mode = GameFocus.IN_MENU
elif mode == GameFocus.IN_MENU:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
$CanvasLayer/GUI.hide()
$Level/Player.input_active = true
mode = Gamemode.PLAYING
mode = GameFocus.PLAYING