extends Node @export_category("UI") @export var UI_SCALE: float = 1 ##rational scale of the ui @export var UI_MOVEMENT_SENSITIVITY = 0.5 ##how much the UI moves when you move the camera @export var UI_MOVEMENT_SPEED = 15.0 ##how fast the UI moves when you move the camera @export var UI_MOVEMENT_VELOCITY_MULTIPLIER = 2.0 ##how much the ui leans when walking or strafing @export var GRAB_PANEL: PackedScene = preload("res://scenes/player/grab_prompt.tscn") @export var EQUIP_PANEL: PackedScene = preload("res://scenes/player/equip_prompt.tscn") @onready var in_game_menu: Control = %InGameMenu @onready var ui: Control = %PlayerUi @onready var popup_panels: Control = %PopupPanels @onready var player_state: Node = %PlayerState @onready var player_manager: Node = %PlayerManager @onready var player: CharacterBody3D = $"../.." @onready var cursor: TextureRect = %Cursor @onready var player_camera: Camera3D = %PlayerCamera const SELECTED_COLOR = 0xcfcfcf78 const UNSELECTED_COLOR = 0x3d3d3d78 var action_panel = null var action_panel_body = null func _on_action_finder_body_entered(body: Node3D) -> void: if body != null: if body.is_in_group("grabbable"): action_panel = GRAB_PANEL.instantiate() if body.is_in_group("equippable"): action_panel = EQUIP_PANEL.instantiate() popup_panels.add_child(action_panel) action_panel_body = body func _on_action_finder_body_exited(body: Node3D) -> void: if body != null and body == action_panel_body: popup_panels.remove_child(action_panel) action_panel = null action_panel_body = null func _process(delta: float) -> void: if action_panel != null: var target_position = cursor.position - player_camera.unproject_position(action_panel_body.global_position) action_panel.position = action_panel.position.lerp(-target_position / 2, delta * 50) func toggle_menu(): if !in_game_menu.visible: ui.visible = false popup_panels.visible = false in_game_menu.visible = true cursor.visible = false Input.mouse_mode = Input.MOUSE_MODE_VISIBLE player_state.in_menu = true else: ui.visible = true popup_panels.visible = true in_game_menu.visible = false cursor.visible = true Input.mouse_mode = Input.MOUSE_MODE_CAPTURED player_state.in_menu = false func set_ui_scale(scale:float) -> void: pass