2021-06-26 15:33:34 +02:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
|
|
var current_material = null
|
|
|
|
|
|
|
|
|
|
func level_hud_slide(node):
|
|
|
|
|
var animation = Animation.new()
|
|
|
|
|
var track_index = animation.add_track(Animation.TYPE_BEZIER)
|
2026-05-16 19:40:03 +02:00
|
|
|
var node_element = str(node.get_path()) + ":position:x"
|
2021-06-26 15:33:34 +02:00
|
|
|
|
|
|
|
|
animation.track_set_path(track_index, node_element)
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 0.0, 0.0, Vector2(-0.25, 0), Vector2(0.031, 190.492))
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 1.0, 170, Vector2(-0.349, 2.576), Vector2(0.25, 0))
|
|
|
|
|
|
|
|
|
|
return animation
|
|
|
|
|
|
|
|
|
|
func level_hud_warning(node):
|
|
|
|
|
var animation = Animation.new()
|
|
|
|
|
var track_index = animation.add_track(Animation.TYPE_BEZIER)
|
2026-05-16 19:40:03 +02:00
|
|
|
var node_element = str(node.get_path()) + ":position:x"
|
2021-06-26 15:33:34 +02:00
|
|
|
|
|
|
|
|
animation.track_set_path(track_index, node_element)
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 0.0, 0.0, Vector2(-0.25, 0), Vector2(0, 78.1))
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 0.2, 34.9, Vector2(-0.25, 0), Vector2(0, -66))
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 0.4, 12.1, Vector2(0, 73.2), Vector2(0, -124.8))
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 0.6, -41.9, Vector2(-0.095, 109.2), Vector2(0.062, -58.8))
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 0.8, 13.3, Vector2(-0.188, 93.6), Vector2(0.196, 104.4))
|
|
|
|
|
animation.bezier_track_insert_key(track_index, 1.0, 0.0, Vector2(-0.155, -135.5), Vector2(0.25, 0))
|
|
|
|
|
|
|
|
|
|
return animation
|
|
|
|
|
|
|
|
|
|
func start_dissolve(node, material):
|
2026-05-16 19:40:03 +02:00
|
|
|
if material == null:
|
|
|
|
|
return
|
2021-06-26 15:33:34 +02:00
|
|
|
current_material = material
|
2026-05-16 19:40:03 +02:00
|
|
|
var tween = node.create_tween()
|
|
|
|
|
tween.tween_method(animate_dissolve, 0.0, 1.0, 1.5) \
|
|
|
|
|
.set_trans(Tween.TRANS_LINEAR) \
|
|
|
|
|
.set_ease(Tween.EASE_IN_OUT)
|
2021-06-26 15:33:34 +02:00
|
|
|
|
|
|
|
|
func animate_dissolve(progress: float) -> void:
|
2026-05-16 19:40:03 +02:00
|
|
|
if current_material == null:
|
|
|
|
|
return
|
2026-05-16 19:18:27 +02:00
|
|
|
current_material.set_shader_parameter("dissolve_amount", ease(progress, 0.4))
|