ajout d'une gui en 3d, d'un tuto et correction de bug à la pelletée
This commit is contained in:
@@ -5,7 +5,7 @@ const MAX_VOLUME = 24.
|
||||
|
||||
@onready var settings : SettingsData = GameInfo.settings_data
|
||||
|
||||
@export var default_fade_time = 1.0
|
||||
@export var default_fade_time = 0.5
|
||||
|
||||
@export var playing_music : AudioStreamPlayer = null
|
||||
@export var playing_ambiance : AudioStreamPlayer = null
|
||||
@@ -91,31 +91,36 @@ func play_sfx(sfx_name : String):
|
||||
printerr("Sfx %s not found" % sfx_name)
|
||||
|
||||
func play_music(music_name : String = ""):
|
||||
if playing_music:
|
||||
await set_volume(playing_music, MIN_VOLUME).finished
|
||||
if playing_music:
|
||||
playing_music.stop()
|
||||
reset_volume(playing_music)
|
||||
var old_music = playing_music
|
||||
playing_music = null
|
||||
if old_music:
|
||||
await set_volume(old_music, MIN_VOLUME).finished
|
||||
if old_music and old_music != playing_music:
|
||||
print(old_music)
|
||||
old_music.stop()
|
||||
reset_volume(old_music)
|
||||
if music_name:
|
||||
var player := %Musics.find_child(music_name) as AudioStreamPlayer
|
||||
if player:
|
||||
playing_music = player
|
||||
player.play()
|
||||
set_volume(player, get_volume_from_parent(player))
|
||||
else:
|
||||
printerr("Music %s not found" % music_name)
|
||||
|
||||
func play_ambiance(ambiance_name : String = ""):
|
||||
if playing_ambiance:
|
||||
await set_volume(playing_ambiance, MIN_VOLUME).finished
|
||||
if playing_ambiance:
|
||||
playing_ambiance.stop()
|
||||
reset_volume(playing_ambiance)
|
||||
var old_ambiance = playing_ambiance
|
||||
playing_ambiance = null
|
||||
if old_ambiance:
|
||||
await set_volume(old_ambiance, MIN_VOLUME).finished
|
||||
if old_ambiance and old_ambiance != playing_ambiance:
|
||||
old_ambiance.stop()
|
||||
reset_volume(old_ambiance)
|
||||
if ambiance_name:
|
||||
var player := %Ambiance.find_child(ambiance_name) as AudioStreamPlayer
|
||||
if player:
|
||||
playing_ambiance = player
|
||||
player.play()
|
||||
set_volume(player, get_volume_from_parent(player))
|
||||
else:
|
||||
printerr("Sfx %s not found" % ambiance_name)
|
||||
printerr("Ambiance %s not found" % ambiance_name)
|
||||
|
||||
Reference in New Issue
Block a user