15 lines
402 B
GDScript
15 lines
402 B
GDScript
class_name HUDComponent
|
|
extends Sprite3D
|
|
|
|
@export var health: HealthComponent
|
|
|
|
var sub_viewport: SubViewport
|
|
|
|
func _ready():
|
|
sub_viewport = %SubViewport
|
|
texture = sub_viewport.get_texture()
|
|
health.value_changed.connect(on_health_changed)
|
|
|
|
func on_health_changed():
|
|
sub_viewport.render_target_clear_mode = SubViewport.CLEAR_MODE_ONCE
|
|
sub_viewport.render_target_update_mode = SubViewport.UPDATE_ONCE |