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:
Floppyrj45
2026-04-19 17:12:44 +02:00
parent 46bcbb27ba
commit af94645d4c
3 changed files with 66 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ config_version=5
[application]
config/name="DauphinCraft"
config/description="Minecraft-like sous-marin — joue un dauphin"
run/main_scene="res://scenes/Main.tscn"
run/main_scene="res://scenes/MainMenu.tscn"
config/features=PackedStringArray("4.6", "Forward Plus")
config/icon="res://icon.svg"

View File

@@ -1,14 +1,29 @@
[gd_scene load_steps=3 format=3]
[gd_scene load_steps=6 format=3 uid="uid://dauphincraft_main"]
[sub_resource type="SphereMesh" id="SphereMesh_1"]
[ext_resource type="Script" path="res://scripts/Main.gd" id="1_mainscript"]
[ext_resource type="Script" path="res://scripts/ambience/UnderwaterEnvironment.gd" id="2_uwenv"]
[ext_resource type="PackedScene" path="res://scenes/World.tscn" id="3_world"]
[ext_resource type="PackedScene" path="res://scenes/Dolphin.tscn" id="4_dolphin"]
[ext_resource type="Script" path="res://scripts/ambience/PlanktonParticles.gd" id="5_plankton"]
[node name="Main" type="Node3D"]
script = ExtResource("1_mainscript")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 5)
[node name="UnderwaterEnvironment" type="WorldEnvironment" parent="."]
script = ExtResource("2_uwenv")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.707, 0.707, 0, -0.707, 0.707, 0, 3, 0)
[node name="SunLight" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.342, 0.940, 0, -0.940, 0.342, 0, 60, 0)
light_color = Color(0.6, 0.85, 1.0, 1)
light_energy = 1.2
shadow_enabled = true
[node name="Sphere" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_1")
[node name="World" parent="." instance=ExtResource("3_world")]
[node name="Dolphin" parent="." instance=ExtResource("4_dolphin")]
position = Vector3(0, 55, 0)
[node name="PlanktonFollower" type="Node3D" parent="."]
[node name="PlanktonParticles" type="GPUParticles3D" parent="PlanktonFollower"]
script = ExtResource("5_plankton")

42
scripts/Main.gd Normal file
View 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)