generated from krampus/template-godot4
Mp3 player updates track list on equip
This commit is contained in:
parent
4343bc1bf5
commit
10598e2377
@ -27,6 +27,10 @@ func fire() -> void:
|
||||
mp3_controller.select()
|
||||
|
||||
|
||||
func on_equip() -> void:
|
||||
_rebuild_track_list()
|
||||
|
||||
|
||||
func switch_mode() -> void:
|
||||
rumbler.intensity = SMALL_RUMBLE
|
||||
mp3_controller.cancel()
|
||||
@ -38,6 +42,10 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
|
||||
func _on_mp3_collected(_track: MP3Track) -> void:
|
||||
_rebuild_track_list()
|
||||
|
||||
|
||||
func _rebuild_track_list() -> void:
|
||||
# TODO we may want to dynamically build the player tracklist
|
||||
# rather than rebuilding the whole thing each time a track is collected
|
||||
var mp3_list: Array[String] = []
|
||||
|
@ -34,6 +34,11 @@ func idle() -> void:
|
||||
_idle()
|
||||
|
||||
|
||||
## Called when this tool is equipped.
|
||||
func on_equip() -> void:
|
||||
pass
|
||||
|
||||
|
||||
## Is this tool available to the player?
|
||||
func unlocked() -> bool:
|
||||
return true
|
||||
|
@ -28,6 +28,7 @@ func set_active(tool: Tool, force: bool = false) -> void:
|
||||
# TODO unequip animation?
|
||||
_active = tool
|
||||
_active.visible = true
|
||||
_active.on_equip()
|
||||
# TODO equip animation?
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@ func _ready() -> void:
|
||||
mp3_player.set_pressed_no_signal(World.instance.manager.mp3_player_unlocked)
|
||||
toothbrush.set_pressed_no_signal(World.instance.manager.toothbrush_unlocked)
|
||||
stickers.set_pressed_no_signal(World.instance.manager.stickers_unlocked)
|
||||
_build_track_list()
|
||||
|
||||
|
||||
func _build_track_list() -> void:
|
||||
|
Loading…
x
Reference in New Issue
Block a user