38 lines
1.0 KiB
GDScript
38 lines
1.0 KiB
GDScript
class_name Santa extends Node3D
|
|
|
|
@onready var animator: AnimationPlayer = $AnimationPlayer
|
|
|
|
func _ready() -> void:
|
|
animator.play("Sit_Chair_Idle")
|
|
|
|
func dive(pos: Vector3, time: float) -> void:
|
|
animator.play("flip")
|
|
|
|
var posTween: Tween = get_tree().create_tween()
|
|
posTween.tween_property(self, "global_position", (pos + global_position) / 2 + Vector3(0, 50, 0), time).set_ease(Tween.EASE_OUT)
|
|
|
|
await get_tree().create_timer(time / 2).timeout
|
|
|
|
posTween.kill()
|
|
posTween = get_tree().create_tween()
|
|
posTween.tween_property(self, "global_position", pos, time / 2).set_ease(Tween.EASE_IN)
|
|
|
|
await get_tree().create_timer(time - (time / 2) - 0.4).timeout
|
|
|
|
City.instance.animator.play("fadeOut")
|
|
|
|
await City.instance.animator.animation_finished
|
|
|
|
Sleigh.instance.cam.clear_current()
|
|
ChimneyGame.instance.startGame()
|
|
|
|
UI.instance.hideMost()
|
|
|
|
City.instance.animator.play_backwards("fadeOut")
|
|
|
|
animator.play("flip", -1, -10, true)
|
|
position = Vector3(0, 1.471, -1.092)
|
|
|
|
await animator.animation_finished
|
|
animator.play("Sit_Chair_Idle")
|