ajout de panneaux de contrôles, de paramètres et refactorisation de la gestion de l'audio

This commit is contained in:
2025-11-22 15:10:41 +01:00
parent dbe8f03531
commit 435415363c
171 changed files with 2165 additions and 922 deletions

View File

@@ -40,5 +40,5 @@ func use(player : Player, zone : Player.ActionZone) -> bool:
return true
func harvest(p : Plant, player: Player):
player.play_sfx("harvest")
AudioManager.play_sfx("Harvest")
p.harvest()

View File

@@ -64,7 +64,7 @@ func use(player : Player, zone : Player.ActionZone) -> bool:
if player.planet == null:
return false
player.play_sfx("dig")
AudioManager.play_sfx("Dig")
return player.planet.plant(
plant_type,
zone.get_global_position(),
@@ -138,7 +138,7 @@ static func mutate(parent_mutation : Array[PlantMutation] = []) -> Array[PlantMu
]
if (
len(parent_mutation) > 2
len(parent_mutation) >= 2
):
possible_mutations = [
UpgradeMutation.new(),

View File

@@ -40,5 +40,5 @@ func use(player : Player, zone : Player.ActionZone) -> bool:
return true
func dig(u: UndergroundLoot, player: Player):
player.play_sfx("dig")
AudioManager.play_sfx("Dig")
u.dig()

View File

@@ -17,5 +17,5 @@ func get_usage_zone_radius() -> int:
func harvest(p : Plant, player: Player):
ProduceSeedsEffect.new(1).effect(p)
player.play_sfx("harvest")
AudioManager.play_sfx("Harvest")
p.harvest()

View File

@@ -1,21 +1,8 @@
[gd_scene load_steps=26 format=3 uid="uid://bgvbgeq46wee2"]
[gd_scene load_steps=8 format=3 uid="uid://bgvbgeq46wee2"]
[ext_resource type="Script" uid="uid://das7twcy5153p" path="res://entities/player/scripts/player.gd" id="1_abrql"]
[ext_resource type="Texture2D" uid="uid://c7ff87jniga5m" path="res://entities/player/assets/sprites/robot.png" id="1_symyc"]
[ext_resource type="AudioStream" uid="uid://dfrp66a4isnt6" path="res://entities/player/sounds/dig/dig_1.wav" id="3_gx6sm"]
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/icons/shovel.svg" id="3_yqrof"]
[ext_resource type="AudioStream" uid="uid://bdxkvaciw4mb3" path="res://entities/player/sounds/dig/dig_2.wav" id="4_yqrof"]
[ext_resource type="AudioStream" uid="uid://llxrlwfccywb" path="res://entities/player/sounds/dig/dig_3.wav" id="5_3wlsy"]
[ext_resource type="AudioStream" uid="uid://8nmr5vifkt1f" path="res://entities/player/sounds/harvest/harvest_1.wav" id="6_b2kln"]
[ext_resource type="AudioStream" uid="uid://dgkdcq4j6fe3o" path="res://entities/player/sounds/harvest/harvest_2.wav" id="7_we0b7"]
[ext_resource type="AudioStream" uid="uid://eh3dbuxu5qtw" path="res://entities/player/sounds/harvest/harvest_3.wav" id="8_mtric"]
[ext_resource type="AudioStream" uid="uid://bown4yipeef8l" path="res://entities/player/sounds/harvest/harvest_4.wav" id="9_eyb6c"]
[ext_resource type="AudioStream" uid="uid://cbo4ld2yypmte" path="res://entities/player/sounds/harvest/harvest_5.wav" id="10_221hk"]
[ext_resource type="AudioStream" uid="uid://c5nfoa6v3r5f7" path="res://entities/player/sounds/harvest/harvest_6.wav" id="11_ghoj8"]
[ext_resource type="AudioStream" uid="uid://bjind1iji0gt7" path="res://entities/player/sounds/pick_up/pick_up_1.wav" id="12_t1t22"]
[ext_resource type="AudioStream" uid="uid://cqa0gvgpoa7pd" path="res://entities/player/sounds/pick_up/pick_up_2.wav" id="13_50fht"]
[ext_resource type="AudioStream" uid="uid://b8inedx4yjslw" path="res://entities/player/sounds/drop/drop_1.wav" id="15_gx6sm"]
[ext_resource type="AudioStream" uid="uid://b4sxly5jsvlkr" path="res://entities/player/sounds/movement/movement.wav" id="15_qpopc"]
[sub_resource type="CircleShape2D" id="CircleShape2D_sglur"]
radius = 27.0
@@ -32,39 +19,6 @@ fill = 1
fill_from = Vector2(0.5, 0.380342)
fill_to = Vector2(1, 0.0726496)
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_wq0jh"]
random_pitch = 1.5
streams_count = 3
stream_0/stream = ExtResource("3_gx6sm")
stream_1/stream = ExtResource("4_yqrof")
stream_2/stream = ExtResource("5_3wlsy")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_gt4e4"]
random_pitch = 1.5
streams_count = 6
stream_0/stream = ExtResource("6_b2kln")
stream_1/stream = ExtResource("7_we0b7")
stream_2/stream = ExtResource("8_mtric")
stream_3/stream = ExtResource("9_eyb6c")
stream_4/stream = ExtResource("10_221hk")
stream_5/stream = ExtResource("11_ghoj8")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_24ehl"]
random_pitch = 1.1
streams_count = 2
stream_0/stream = ExtResource("12_t1t22")
stream_1/stream = ExtResource("13_50fht")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_bwdx1"]
random_pitch = 1.5
streams_count = 1
stream_0/stream = ExtResource("15_qpopc")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_yqrof"]
random_pitch = 1.25
streams_count = 1
stream_0/stream = ExtResource("15_gx6sm")
[node name="Player" type="CharacterBody2D"]
script = ExtResource("1_abrql")
@@ -97,26 +51,3 @@ modulate = Color(0.164706, 0.898039, 0.984314, 1)
position = Vector2(8.25, -27.32)
scale = Vector2(0.403333, 0.403333)
texture = ExtResource("3_yqrof")
[node name="Audio" type="Node2D" parent="."]
[node name="AudioStreamPlayer_dig" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_wq0jh")
volume_db = -12.5
[node name="AudioStreamPlayer_harvest" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_gt4e4")
volume_db = -10.0
pitch_scale = 1.5
[node name="AudioStreamPlayer_pick_up" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_24ehl")
volume_db = -25.0
[node name="AudioStreamPlayer_movement" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_bwdx1")
volume_db = -80.0
[node name="AudioStreamPlayer_drop" type="AudioStreamPlayer" parent="Audio"]
stream = SubResource("AudioStreamRandomizer_yqrof")
volume_db = -15.0

View File

@@ -57,7 +57,6 @@ func _end_pass_day():
func _process(delta):
last_action_area_movement_timer += delta
if controlling_player:
var old_velocity=velocity
calculate_direction()
if (
@@ -67,10 +66,6 @@ func _process(delta):
instruction.do(self)
instruction = null
move_preview_zone(get_global_mouse_position())
# Sound
if old_velocity.length()==0 and velocity.length()!=0:
play_sfx("move")
else:
velocity = Vector2.ZERO
move_and_slide()
@@ -122,7 +117,7 @@ func try_move(move_to : Vector2):
instruction = MoveInstruction.new(move_to)
func pick_item(item : Item) -> Item:
play_sfx("pick")
AudioManager.play_sfx("PickUp")
if data.inventory.is_full():
drop_item()
@@ -143,7 +138,7 @@ func drop_item():
var item_to_drop = data.inventory.pop_item()
if item_to_drop:
terrain.drop_item(item_to_drop, global_position)
play_sfx("drop")
AudioManager.play_sfx("Drop")
func delete_item(item: Item):
data.inventory.remove_item(item)
@@ -231,19 +226,6 @@ func move_preview_zone(zone_position : Vector2):
if preview_zone:
preview_zone.move_to_position(zone_position)
func play_sfx(sound : String):
match sound:
"dig":
$Audio/AudioStreamPlayer_dig.play()
"harvest":
$Audio/AudioStreamPlayer_harvest.play()
"pick":
$Audio/AudioStreamPlayer_pick_up.play()
"drop":
$Audio/AudioStreamPlayer_drop.play()
"move":
$Audio/AudioStreamPlayer_movement.play()
class Instruction:
var position : Vector2

Binary file not shown.

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dfrp66a4isnt6"
path="res://.godot/imported/dig_1.wav-76555a8720a69a7ba42f82311d7beaf8.sample"
[deps]
source_file="res://entities/player/sounds/dig/dig_1.wav"
dest_files=["res://.godot/imported/dig_1.wav-76555a8720a69a7ba42f82311d7beaf8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bdxkvaciw4mb3"
path="res://.godot/imported/dig_2.wav-4085353199cf7c47c8a581183b92f4a4.sample"
[deps]
source_file="res://entities/player/sounds/dig/dig_2.wav"
dest_files=["res://.godot/imported/dig_2.wav-4085353199cf7c47c8a581183b92f4a4.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

Binary file not shown.

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://llxrlwfccywb"
path="res://.godot/imported/dig_3.wav-0c0bb89a725edb73ca5a10e31a6cc9ce.sample"
[deps]
source_file="res://entities/player/sounds/dig/dig_3.wav"
dest_files=["res://.godot/imported/dig_3.wav-0c0bb89a725edb73ca5a10e31a6cc9ce.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b8inedx4yjslw"
path="res://.godot/imported/drop_1.wav-f55a19d009cc812aa27af99dd38f04e7.sample"
[deps]
source_file="res://entities/player/sounds/drop/drop_1.wav"
dest_files=["res://.godot/imported/drop_1.wav-f55a19d009cc812aa27af99dd38f04e7.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://8nmr5vifkt1f"
path="res://.godot/imported/harvest_1.wav-556288586fc74dbc9e6e114c8da94313.sample"
[deps]
source_file="res://entities/player/sounds/harvest/harvest_1.wav"
dest_files=["res://.godot/imported/harvest_1.wav-556288586fc74dbc9e6e114c8da94313.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dgkdcq4j6fe3o"
path="res://.godot/imported/harvest_2.wav-725aa211bb996cf5e7c0f8044f1a0596.sample"
[deps]
source_file="res://entities/player/sounds/harvest/harvest_2.wav"
dest_files=["res://.godot/imported/harvest_2.wav-725aa211bb996cf5e7c0f8044f1a0596.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://eh3dbuxu5qtw"
path="res://.godot/imported/harvest_3.wav-311bb1444da6f3ce34003b61b417f328.sample"
[deps]
source_file="res://entities/player/sounds/harvest/harvest_3.wav"
dest_files=["res://.godot/imported/harvest_3.wav-311bb1444da6f3ce34003b61b417f328.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bown4yipeef8l"
path="res://.godot/imported/harvest_4.wav-7e79f33b699be1fa97bd3397f39b13b8.sample"
[deps]
source_file="res://entities/player/sounds/harvest/harvest_4.wav"
dest_files=["res://.godot/imported/harvest_4.wav-7e79f33b699be1fa97bd3397f39b13b8.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cbo4ld2yypmte"
path="res://.godot/imported/harvest_5.wav-39f01e30ca86bf5c233491f011175058.sample"
[deps]
source_file="res://entities/player/sounds/harvest/harvest_5.wav"
dest_files=["res://.godot/imported/harvest_5.wav-39f01e30ca86bf5c233491f011175058.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c5nfoa6v3r5f7"
path="res://.godot/imported/harvest_6.wav-2e0a40cb05e9420a9f46463c9b5ddae3.sample"
[deps]
source_file="res://entities/player/sounds/harvest/harvest_6.wav"
dest_files=["res://.godot/imported/harvest_6.wav-2e0a40cb05e9420a9f46463c9b5ddae3.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b4sxly5jsvlkr"
path="res://.godot/imported/movement.wav-eff57eb45a7ca8b1e138ffe135ccf98e.sample"
[deps]
source_file="res://entities/player/sounds/movement/movement.wav"
dest_files=["res://.godot/imported/movement.wav-eff57eb45a7ca8b1e138ffe135ccf98e.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bjind1iji0gt7"
path="res://.godot/imported/pick_up_1.wav-0e258b69af06c5691f2997179a1bf36b.sample"
[deps]
source_file="res://entities/player/sounds/pick_up/pick_up_1.wav"
dest_files=["res://.godot/imported/pick_up_1.wav-0e258b69af06c5691f2997179a1bf36b.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2

View File

@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cqa0gvgpoa7pd"
path="res://.godot/imported/pick_up_2.wav-ccfd626b41684f4735889c5b2d905e6f.sample"
[deps]
source_file="res://entities/player/sounds/pick_up/pick_up_2.wav"
dest_files=["res://.godot/imported/pick_up_2.wav-ccfd626b41684f4735889c5b2d905e6f.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2