feat(nav): add GameState.set_current_room and AudioManager.DEFAULT_MUSIC_VOLUME
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
const CROSSFADE_DURATION: float = 0.8
|
const CROSSFADE_DURATION: float = 0.8
|
||||||
|
const DEFAULT_MUSIC_VOLUME: float = 0.6
|
||||||
|
|
||||||
const _MUSIC_MAP: Dictionary = {
|
const _MUSIC_MAP: Dictionary = {
|
||||||
0: "res://assets/audio/music/floor_0.ogg",
|
0: "res://assets/audio/music/floor_0.ogg",
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ func clear_chest_state(chest_id: String) -> void:
|
|||||||
state_changed.emit()
|
state_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func set_current_room(room: String) -> void:
|
||||||
|
current_room = room
|
||||||
|
state_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
func get_save_data() -> Dictionary:
|
func get_save_data() -> Dictionary:
|
||||||
var positions: Dictionary = {}
|
var positions: Dictionary = {}
|
||||||
for key: String in _character_positions:
|
for key: String in _character_positions:
|
||||||
|
|||||||
@@ -69,3 +69,7 @@ func test_music_map_has_all_four_floors() -> void:
|
|||||||
assert_true(AudioManager._MUSIC_MAP.has(1))
|
assert_true(AudioManager._MUSIC_MAP.has(1))
|
||||||
assert_true(AudioManager._MUSIC_MAP.has(2))
|
assert_true(AudioManager._MUSIC_MAP.has(2))
|
||||||
assert_true(AudioManager._MUSIC_MAP.has(3))
|
assert_true(AudioManager._MUSIC_MAP.has(3))
|
||||||
|
|
||||||
|
|
||||||
|
func test_default_music_volume_constant_is_0_6() -> void:
|
||||||
|
assert_eq(AudioManager.DEFAULT_MUSIC_VOLUME, 0.6)
|
||||||
|
|||||||
@@ -181,3 +181,16 @@ func test_apply_save_data_restores_chest_state() -> void:
|
|||||||
}
|
}
|
||||||
GameState.apply_save_data(data)
|
GameState.apply_save_data(data)
|
||||||
assert_eq(GameState.get_chest_state("reception_desk_test"), ["clipboard", "pen"])
|
assert_eq(GameState.get_chest_state("reception_desk_test"), ["clipboard", "pen"])
|
||||||
|
|
||||||
|
|
||||||
|
func test_set_current_room_updates_value() -> void:
|
||||||
|
GameState.set_current_room("xray")
|
||||||
|
assert_eq(GameState.current_room, "xray")
|
||||||
|
GameState.set_current_room("reception")
|
||||||
|
|
||||||
|
|
||||||
|
func test_set_current_room_emits_state_changed() -> void:
|
||||||
|
watch_signals(GameState)
|
||||||
|
GameState.set_current_room("pharmacy")
|
||||||
|
assert_signal_emitted(GameState, "state_changed")
|
||||||
|
GameState.set_current_room("reception")
|
||||||
|
|||||||
Reference in New Issue
Block a user