41 lines
1.3 KiB
GDScript
41 lines
1.3 KiB
GDScript
extends CanvasLayer
|
|
|
|
func _ready() -> void:
|
|
GDRx.from_signal(Messagebus.DEBUG_XYZ).subscribe(display_xy).dispose_with(self)
|
|
GDRx.from_signal(Messagebus.CHANGE_SCENE).subscribe(display_map).dispose_with(self)
|
|
|
|
#$FlipPage.set_shader_parameter("scale", Vector3(100,100,100))
|
|
|
|
func display_xy(origin: Vector3) -> void:
|
|
var xyzlabel = $Control/MarginContainer/BoxContainer/VBoxContainer/XYZLabel
|
|
xyzlabel.text = " x:" + str(snapped(origin.x, 0.01)) + \
|
|
" y:" + str(snapped(origin.y, 0.01)) + \
|
|
" z:" + str(snapped(origin.z, 0.01))
|
|
|
|
func display_map(name: String) -> void:
|
|
var maplabel = $Control/MarginContainer/BoxContainer/VBoxContainer/MapLabel
|
|
maplabel.text = "Map: "+name
|
|
transition_start()
|
|
|
|
func transition_start() -> void:
|
|
var t = $Transition
|
|
GDRx.start_periodic_timer(0.05).\
|
|
take(20).\
|
|
subscribe(
|
|
func(i): t.material.set("shader_parameter/right", clampf((-(1/4)*pow(i, 2))+i+(5/4), -1, 5)),
|
|
print,
|
|
func(): t.material.set("shader_parameter/right", -1)
|
|
).\
|
|
dispose_with(self)
|
|
await get_tree().create_timer(0.8).timeout
|
|
GDRx.start_periodic_timer(0.05).\
|
|
take(20).\
|
|
subscribe(
|
|
func(i): t.material.set("shader_parameter/left", clampf((-(1/4)*pow(i, 2))+i+(5/4), -1, 5)),
|
|
print,
|
|
func(): t.material.set("shader_parameter/left", -1)
|
|
).\
|
|
dispose_with(self)
|
|
|
|
|