15 lines
402 B
GDScript3
Raw Normal View History

2024-02-12 23:22:27 +00:00
class_name HUDComponent
extends Sprite3D
@export var health: HealthComponent
2024-02-26 22:50:56 +00:00
var sub_viewport: SubViewport
2024-02-12 23:22:27 +00:00
func _ready():
2024-02-26 22:50:56 +00:00
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