added some sound triggers and holes in the map
This commit is contained in:
23
Scripts/Resources/player_audio_settings.gd
Normal file
23
Scripts/Resources/player_audio_settings.gd
Normal file
@ -0,0 +1,23 @@
|
||||
extends Resource
|
||||
class_name PlayerAudioSettings
|
||||
|
||||
const SAVE_PATH := "user://audio_settings.tres"
|
||||
|
||||
@export var master := 100.0
|
||||
@export var music := 100.0
|
||||
@export var sfx := 100.0
|
||||
|
||||
|
||||
func apply_audio_settings():
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(master / 100.0))
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(music / 100.0))
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(sfx / 100.0))
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> PlayerAudioSettings:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return PlayerAudioSettings.new()
|
||||
|
26
Scripts/Resources/save_stats.gd
Normal file
26
Scripts/Resources/save_stats.gd
Normal file
@ -0,0 +1,26 @@
|
||||
extends Resource
|
||||
class_name SaveStats
|
||||
|
||||
const SAVE_PATH := "user://save_stats.tres"
|
||||
|
||||
@export var wins: int
|
||||
@export var losses: int
|
||||
@export var twenty_game_history: Array[bool]
|
||||
|
||||
|
||||
func add_game_outcome(outcome: bool) -> void:
|
||||
if outcome:
|
||||
wins += 1
|
||||
else:
|
||||
losses += 1
|
||||
twenty_game_history.push_back(outcome)
|
||||
if twenty_game_history.size() > 20:
|
||||
twenty_game_history.pop_front()
|
||||
|
||||
|
||||
func save_profile_to_disk():
|
||||
ResourceSaver.save(self, SAVE_PATH)
|
||||
static func load_profile_from_disk() -> SaveStats:
|
||||
if ResourceLoader.exists(SAVE_PATH):
|
||||
return ResourceLoader.load(SAVE_PATH)
|
||||
return SaveStats.new()
|
Reference in New Issue
Block a user