62 lines
1.7 KiB
GDScript
62 lines
1.7 KiB
GDScript
extends Node2D
|
|
|
|
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
|
@onready var sfx_player: AudioStreamPlayer = $SFXPlayer
|
|
var stream_player: AudioStreamPlaybackInteractive
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
stream_player = sfx_player.get_stream_playback() as AudioStreamPlaybackInteractive
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
|
|
func play_list_up_sfx() -> void:
|
|
stream_player.switch_to_clip_by_name("list_up")
|
|
|
|
func play_list_down_sfx() -> void:
|
|
stream_player.switch_to_clip_by_name("list_down")
|
|
|
|
func play_list_side_sfx() -> void:
|
|
stream_player.switch_to_clip_by_name("list_side")
|
|
|
|
|
|
func _on_guest_list_mouse_entered() -> void:
|
|
animation_player.queue("guest_list_up")
|
|
|
|
|
|
func _on_guest_list_mouse_exited() -> void:
|
|
animation_player.play_backwards("guest_list_up")
|
|
|
|
|
|
func _on_mask_list_mouse_entered() -> void:
|
|
animation_player.queue("mask_list_up")
|
|
|
|
|
|
func _on_mask_list_mouse_exited() -> void:
|
|
animation_player.play_backwards("mask_list_up")
|
|
|
|
|
|
func _on_mask_list_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
|
if event is InputEventMouseButton and event.is_pressed():
|
|
play_list_side_sfx()
|
|
|
|
|
|
func _on_guest_list_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
|
if event is InputEventMouseButton and event.is_pressed():
|
|
play_list_side_sfx()
|
|
|
|
func _on_game_manager_defeat_noise() -> void:
|
|
stream_player.switch_to_clip_by_name("defeat")
|
|
|
|
|
|
func _on_game_manager_ring_bell_noise() -> void:
|
|
stream_player.switch_to_clip_by_name("bell")
|
|
|
|
|
|
func _on_game_manager_victory_noise() -> void:
|
|
stream_player.switch_to_clip_by_name("victory")
|