2026-03-13 21:52:21 +00:00
|
|
|
#@tool
|
|
|
|
|
#@icon(icon_path: String)
|
|
|
|
|
class_name Musician
|
|
|
|
|
extends AnimatedSprite2D
|
|
|
|
|
## Documentation comments
|
|
|
|
|
|
|
|
|
|
# signal
|
|
|
|
|
# enum
|
2026-03-14 02:52:18 +00:00
|
|
|
#const
|
|
|
|
|
|
|
|
|
|
@export_group("Input Textures")
|
|
|
|
|
@export var solid_texture: Texture2D
|
|
|
|
|
@export var outline_texture: Texture2D
|
|
|
|
|
|
2026-03-13 21:52:21 +00:00
|
|
|
var is_active: bool = false
|
|
|
|
|
|
2026-03-14 02:52:18 +00:00
|
|
|
@onready var audio: AudioStreamPlayer2D = %Audio
|
|
|
|
|
@onready var light: PointLight2D = %Light
|
|
|
|
|
@onready var occluder: LightOccluder2D = %Occluder
|
|
|
|
|
@onready var input_prompt: Sprite2D = %InputPrompt
|
2026-03-13 21:52:21 +00:00
|
|
|
|
|
|
|
|
## OVERRIDES
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
light.visible = false
|
|
|
|
|
audio.connect("finished", enter_exit)
|
2026-03-14 02:52:18 +00:00
|
|
|
input_prompt.texture = outline_texture
|
|
|
|
|
audio.volume_db = -100.0
|
|
|
|
|
is_active = true
|
|
|
|
|
|
2026-03-13 21:52:21 +00:00
|
|
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
## CORE
|
|
|
|
|
func enter_exit() -> void:
|
|
|
|
|
if is_active:
|
|
|
|
|
play("idle")
|
2026-03-14 02:52:18 +00:00
|
|
|
#audio.stop()
|
|
|
|
|
audio.volume_db = -100.0
|
2026-03-13 21:52:21 +00:00
|
|
|
light.visible = false
|
|
|
|
|
is_active = false
|
2026-03-14 02:52:18 +00:00
|
|
|
input_prompt.texture = outline_texture
|
2026-03-13 21:52:21 +00:00
|
|
|
else:
|
|
|
|
|
play("default")
|
2026-03-14 02:52:18 +00:00
|
|
|
#audio.play()
|
|
|
|
|
audio.volume_db = 0.0
|
2026-03-13 21:52:21 +00:00
|
|
|
light.visible = true
|
|
|
|
|
is_active = true
|
2026-03-14 02:52:18 +00:00
|
|
|
input_prompt.texture = solid_texture
|
2026-03-13 21:52:21 +00:00
|
|
|
|
|
|
|
|
## PRIVATE/HELPER
|
|
|
|
|
|
|
|
|
|
## RECEIVERS
|
|
|
|
|
|
|
|
|
|
## SETTERS/GETTERS
|