feat: implement global SFXManager singleton and integrate into main scene initialization

This commit is contained in:
Yogi Wiguna
2026-03-31 12:40:57 +08:00
parent 82f2811c26
commit cc207bca3d
3 changed files with 36 additions and 8 deletions
+7 -3
View File
@@ -720,8 +720,12 @@ func _auto_start_from_lobby():
func _start_game():
if multiplayer.is_server():
# Delay spawn assignment to allow clients to finish instantiating Player nodes
# via MultiplayerSpawner. If called too early, the RPC is dropped and clients
# are left misplaced at the default starting position.
await get_tree().create_timer(1.0).timeout
# NOW assign spawn positions for EVERYONE (Host, Client, Bots)
# We do this BEFORE the stabilization delay so players are moved away from (0,0) immediately.
_assign_random_spawn_positions()
# Wait for Nakama websocket to actually be open, up to 5 seconds
@@ -735,9 +739,9 @@ func _start_game():
wait_time += 0.2
# Stabilization delay to allow clients to finish loading and spawning
# We wait 1.5s to ensure the 1.2s loading screen buffer has finished
# We wait 0.5s to ensure the remainder of the 1.2s loading screen buffer has finished
# before the countdown starts.
await get_tree().create_timer(1.5).timeout
await get_tree().create_timer(0.5).timeout
# PRE-GAME COUNTDOWN (3s)
# Spawn static obstacles before countdown starts (Stop n Go only)