feat: 添加生命值回复事件,组件,浮动文字

This commit is contained in:
luke358
2026-05-22 21:36:13 +08:00
parent 1cf4eeecc6
commit 2150fb8de8
6 changed files with 21 additions and 1 deletions
+9
View File
@@ -107,3 +107,12 @@ func _on_dash_timer_timeout() -> void:
move_dir = Vector2.ZERO
collision.set_deferred("disabled", false)
dash_cooldown_timer.start()
func _on_hp_regen_timer_timeout() -> void:
if health_component.current_health <= 0:
return
if health_component.current_health < stats.health:
var heal := stats.hp_regen
health_component.heal(heal)
Global.on_create_heal_text.emit(self, heal)
@@ -152,5 +152,10 @@ shape = SubResource("CircleShape2D_ht2l1")
back_color = Color(0.13725491, 0.019607844, 0.02745098, 1)
fill_color = Color(1, 0.2901961, 0.45490196, 1)
[node name="HPRegenTimer" type="Timer" parent="." index="11" unique_id=884883148]
wait_time = 3.0
autostart = true
[connection signal="timeout" from="DashTimer" to="." method="_on_dash_timer_timeout"]
[connection signal="timeout" from="TrailTimer" to="Visuals/Trail" method="_on_trail_timer_timeout"]
[connection signal="timeout" from="HPRegenTimer" to="." method="_on_hp_regen_timer_timeout"]