23 lines
505 B
GDScript
23 lines
505 B
GDScript
extends Node
|
|
|
|
func set_bgm(value):
|
|
if %BGM.stream == null:
|
|
%BGM.stream = value
|
|
%BGM.play()
|
|
else:
|
|
var tween = get_tree().create_tween()
|
|
tween.tween_property(%BGM, "volume_db",-20 , 1)
|
|
await get_tree().create_timer(1).timeout
|
|
%BGM.stream = value
|
|
%BGM.play()
|
|
tween = get_tree().create_tween()
|
|
tween.tween_property(%BGM, "volume_db",0 , 0.5)
|
|
func play_effect(value):
|
|
%Effect.stream=value
|
|
%Effect.play()
|
|
|
|
|
|
func _on_bgm_finished() -> void:
|
|
%BGM.play()
|
|
pass # Replace with function body.
|