goodnight_jellybean/godot/assets/audio/AmbientSound.gd

30 lines
724 B
GDScript

extends Node
onready var drone_fsm: AnimationNodeStateMachinePlayback = $DroneAudioFSM.get("parameters/playback")
func _ready():
GlobalCursorState.connect("set_camera_zone", self, "check_attic")
$NormalDrone.play()
yield(get_tree().create_timer(.1), "timeout")
$SicklyDrone.play()
var has_scared = false
func _on_AnimationTree_motion_status(value):
if value:
drone_fsm.travel("play_sickly_drone")
else:
drone_fsm.travel("play_normal_drone")
func check_attic(where):
if where == "camera_attic_inner" and not has_scared:
yield(GlobalCursorState, "unfreeze")
$NormalDrone.stop()
$SicklyDrone.stop()
$SicklyDrone2.play()
yield($SicklyDrone2, "finished")
$NormalDrone.play()
$SicklyDrone.play()