extends Control # Internal monologue display (per D-015) # Shows character's internal thoughts as text overlay @onready var text_panel: PanelContainer = $PanelContainer @onready var text_label: RichTextLabel = $PanelContainer/MarginContainer/RichTextLabel var fade_timer: float = 0.0 var fade_duration: float = 5.0 # Display duration before fade var is_visible: bool = false func _ready() -> void: print("MonologueDisplay: Initialized") text_panel.modulate.a = 0.0 is_visible = false func _process(delta: float) -> void: # Auto-fade after display if is_visible: fade_timer += delta if fade_timer >= fade_duration: _fade_out() # Show internal monologue text func show_monologue(text: String, duration: float = 5.0) -> void: text_label.text = text fade_duration = duration fade_timer = 0.0 is_visible = true # Fade in var tween = create_tween() tween.tween_property(text_panel, "modulate:a", 1.0, 0.3) # Fade out the monologue func _fade_out() -> void: if not is_visible: return is_visible = false var tween = create_tween() tween.tween_property(text_panel, "modulate:a", 0.0, 0.5)