2025-03-05 14:46:13 -07:00
|
|
|
class_name PlayerHUD extends Control
|
|
|
|
|
2025-03-05 15:35:49 -07:00
|
|
|
const TRANSITION_TIME := 0.06
|
2025-03-05 14:46:13 -07:00
|
|
|
|
|
|
|
const COLOR_VISIBLE := Color("#ffffffee")
|
|
|
|
const COLOR_DISABLED := Color("#cccccc44")
|
|
|
|
const COLOR_INVISIBLE := Color("#ffffff00")
|
|
|
|
|
|
|
|
@onready var interact_hud: Control = %InteractHUD
|
|
|
|
|
|
|
|
|
|
|
|
func _transition_color(element: CanvasItem, color: Color) -> void:
|
|
|
|
create_tween().tween_property(element, "modulate", color, TRANSITION_TIME).set_trans(
|
|
|
|
Tween.TRANS_CUBIC
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func _to_visible(element: Control) -> void:
|
|
|
|
_transition_color(element, COLOR_VISIBLE)
|
|
|
|
|
|
|
|
|
|
|
|
func _to_disabled(element: Control) -> void:
|
|
|
|
_transition_color(element, COLOR_DISABLED)
|
|
|
|
|
|
|
|
|
|
|
|
func _to_invisible(element: Control) -> void:
|
|
|
|
_transition_color(element, COLOR_INVISIBLE)
|
|
|
|
|
|
|
|
|
|
|
|
func select_interactive(prop: Interactive) -> void:
|
|
|
|
if prop:
|
2025-03-05 15:35:49 -07:00
|
|
|
if prop.enabled:
|
2025-03-05 14:46:13 -07:00
|
|
|
_to_visible(interact_hud)
|
2025-03-05 15:35:49 -07:00
|
|
|
else:
|
|
|
|
_to_disabled(interact_hud)
|
2025-03-05 14:46:13 -07:00
|
|
|
else:
|
|
|
|
_to_invisible(interact_hud)
|