feat(integration): Main scene wires world+dolphin+ambience with signal routing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
42
scripts/Main.gd
Normal file
42
scripts/Main.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
extends Node3D
|
||||
|
||||
@onready var world: Node3D = $World/ChunkManager
|
||||
@onready var dolphin: CharacterBody3D = $Dolphin
|
||||
@onready var hud: CanvasLayer = $Dolphin/HUD
|
||||
@onready var plankton_follower: Node3D = $PlanktonFollower
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
dolphin.block_break_requested.connect(_on_block_break)
|
||||
dolphin.block_place_requested.connect(_on_block_place)
|
||||
dolphin.echolocation_triggered.connect(_on_echolocation)
|
||||
|
||||
if is_instance_valid(hud) and hud.has_method("connect_to_dolphin"):
|
||||
hud.connect_to_dolphin(dolphin)
|
||||
|
||||
AudioManager.play_ambient_loop("underwater_ambient")
|
||||
AudioManager.play_music("underwater_theme")
|
||||
AudioManager.play_whale_call_random()
|
||||
|
||||
world.world_seed = 12345
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
world.update_player_position(dolphin.global_position)
|
||||
plankton_follower.global_position = dolphin.global_position
|
||||
|
||||
|
||||
func _on_block_break(hit_position: Vector3, _normal: Vector3) -> void:
|
||||
var broken_id := world.break_block(hit_position)
|
||||
if broken_id > 0:
|
||||
AudioManager.play_bubble_sfx(hit_position)
|
||||
|
||||
|
||||
func _on_block_place(hit_position: Vector3, normal: Vector3) -> void:
|
||||
var place_pos := hit_position + normal * 0.5
|
||||
var current_selected_block := 2
|
||||
world.place_block(place_pos, current_selected_block)
|
||||
|
||||
|
||||
func _on_echolocation(position: Vector3, _radius: float) -> void:
|
||||
AudioManager.play_bubble_sfx(position)
|
||||
Reference in New Issue
Block a user