Switched to Godot's range fade
This commit is contained in:
@ -70,13 +70,9 @@ script = ExtResource("1_8gebs")
|
||||
[node name="Armature" parent="Model/Female" index="0"]
|
||||
transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.000305099, -0.000408816)
|
||||
|
||||
[node name="Body" parent="Model/Female/Armature/GeneralSkeleton" index="0"]
|
||||
|
||||
[node name="Chest" parent="Model/Female/Armature/GeneralSkeleton" index="1"]
|
||||
visible = false
|
||||
|
||||
[node name="Face" parent="Model/Female/Armature/GeneralSkeleton" index="2"]
|
||||
|
||||
[node name="Hips" parent="Model/Female/Armature/GeneralSkeleton" index="3"]
|
||||
visible = false
|
||||
|
||||
@ -106,6 +102,9 @@ shape = SubResource("CapsuleShape3D_2f50n")
|
||||
|
||||
[node name="HUD" parent="." node_paths=PackedStringArray("health") instance=ExtResource("7_fwgtd")]
|
||||
layers = 512
|
||||
visibility_range_end = 50.0
|
||||
visibility_range_end_margin = 10.0
|
||||
visibility_range_fade_mode = 1
|
||||
health = NodePath("../Health")
|
||||
|
||||
[node name="Attractor" type="GPUParticlesAttractorSphere3D" parent="."]
|
||||
|
@ -3,7 +3,6 @@ extends Node
|
||||
|
||||
@export var health: HealthComponent
|
||||
@export var hud: HUDComponent
|
||||
@export var hud_distance: float
|
||||
@export var physics_distance: float
|
||||
@export var render_distance: float
|
||||
|
||||
@ -12,15 +11,10 @@ var main_player_distance_sq: float
|
||||
|
||||
func _ready():
|
||||
parent = owner
|
||||
hud_distance *= hud_distance
|
||||
physics_distance *= physics_distance
|
||||
render_distance *= render_distance
|
||||
update_visibility()
|
||||
|
||||
func _process(_delta):
|
||||
if hud.visible:
|
||||
hud.transparency = 1.0 - (hud_distance - main_player_distance_sq) * 0.001
|
||||
|
||||
func update_visibility():
|
||||
if !Global.player:
|
||||
return
|
||||
@ -30,5 +24,4 @@ func update_visibility():
|
||||
|
||||
main_player_distance_sq = parent.global_position.distance_squared_to(Global.player.global_position)
|
||||
parent.visible = main_player_distance_sq < render_distance
|
||||
hud.visible = main_player_distance_sq < hud_distance
|
||||
DeathComponent.set_physics(parent, main_player_distance_sq < physics_distance)
|
||||
|
Reference in New Issue
Block a user