diff --git a/assets/voice/english/battle_control_offline.ogg b/assets/voice/english/battle_control_offline.ogg new file mode 100644 index 0000000..c6c5493 Binary files /dev/null and b/assets/voice/english/battle_control_offline.ogg differ diff --git a/assets/voice/english/battle_control_offline.ogg.import b/assets/voice/english/battle_control_offline.ogg.import new file mode 100644 index 0000000..211d0c9 --- /dev/null +++ b/assets/voice/english/battle_control_offline.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://d1s4aitn3ee23" +path="res://.godot/imported/battle_control_offline.ogg-dfc9578bd66a366ed00dc5f9c835faa6.oggvorbisstr" + +[deps] + +source_file="res://assets/voice/english/battle_control_offline.ogg" +dest_files=["res://.godot/imported/battle_control_offline.ogg-dfc9578bd66a366ed00dc5f9c835faa6.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/voice/english/battle_control_online.ogg b/assets/voice/english/battle_control_online.ogg new file mode 100644 index 0000000..7783c64 Binary files /dev/null and b/assets/voice/english/battle_control_online.ogg differ diff --git a/assets/voice/english/battle_control_online.ogg.import b/assets/voice/english/battle_control_online.ogg.import new file mode 100644 index 0000000..06dbec3 --- /dev/null +++ b/assets/voice/english/battle_control_online.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://c155b0rolpjco" +path="res://.godot/imported/battle_control_online.ogg-2aaf91e41e818b979090c12983665f2c.oggvorbisstr" + +[deps] + +source_file="res://assets/voice/english/battle_control_online.ogg" +dest_files=["res://.godot/imported/battle_control_online.ogg-2aaf91e41e818b979090c12983665f2c.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/voice/english/not_enough_resources.ogg b/assets/voice/english/not_enough_resources.ogg new file mode 100644 index 0000000..bf7f0ce Binary files /dev/null and b/assets/voice/english/not_enough_resources.ogg differ diff --git a/assets/voice/english/not_enough_resources.ogg.import b/assets/voice/english/not_enough_resources.ogg.import new file mode 100644 index 0000000..89df702 --- /dev/null +++ b/assets/voice/english/not_enough_resources.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://dfl45ey8krrv8" +path="res://.godot/imported/not_enough_resources.ogg-3fe52634a179f72e03b6a5671ce83bd2.oggvorbisstr" + +[deps] + +source_file="res://assets/voice/english/not_enough_resources.ogg" +dest_files=["res://.godot/imported/not_enough_resources.ogg-3fe52634a179f72e03b6a5671ce83bd2.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/voice/english/training.ogg b/assets/voice/english/training.ogg new file mode 100644 index 0000000..638e447 Binary files /dev/null and b/assets/voice/english/training.ogg differ diff --git a/assets/voice/english/training.ogg.import b/assets/voice/english/training.ogg.import new file mode 100644 index 0000000..41c55e2 --- /dev/null +++ b/assets/voice/english/training.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://dys221ycstc4y" +path="res://.godot/imported/training.ogg-afecb3126489a835af1b623f2160f675.oggvorbisstr" + +[deps] + +source_file="res://assets/voice/english/training.ogg" +dest_files=["res://.godot/imported/training.ogg-afecb3126489a835af1b623f2160f675.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/voice/english/unit_under_attack.ogg b/assets/voice/english/unit_under_attack.ogg new file mode 100644 index 0000000..f4e045c Binary files /dev/null and b/assets/voice/english/unit_under_attack.ogg differ diff --git a/assets/voice/english/unit_under_attack.ogg.import b/assets/voice/english/unit_under_attack.ogg.import new file mode 100644 index 0000000..b2d8120 --- /dev/null +++ b/assets/voice/english/unit_under_attack.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://bn0267jmm3jnp" +path="res://.godot/imported/unit_under_attack.ogg-ffdfe38e888c546dd74f0bcdddd3a4a8.oggvorbisstr" + +[deps] + +source_file="res://assets/voice/english/unit_under_attack.ogg" +dest_files=["res://.godot/imported/unit_under_attack.ogg-ffdfe38e888c546dd74f0bcdddd3a4a8.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/voice/english/your_base_is_under_attack.ogg b/assets/voice/english/your_base_is_under_attack.ogg new file mode 100644 index 0000000..7458434 Binary files /dev/null and b/assets/voice/english/your_base_is_under_attack.ogg differ diff --git a/assets/voice/english/your_base_is_under_attack.ogg.import b/assets/voice/english/your_base_is_under_attack.ogg.import new file mode 100644 index 0000000..da07cf7 --- /dev/null +++ b/assets/voice/english/your_base_is_under_attack.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://c573tv2alltun" +path="res://.godot/imported/your_base_is_under_attack.ogg-26681f5a6003edb415a14f5e243cf7ea.oggvorbisstr" + +[deps] + +source_file="res://assets/voice/english/your_base_is_under_attack.ogg" +dest_files=["res://.godot/imported/your_base_is_under_attack.ogg-26681f5a6003edb415a14f5e243cf7ea.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/source/match/Match.gd b/source/match/Match.gd index b3f134f..9c95f94 100644 --- a/source/match/Match.gd +++ b/source/match/Match.gd @@ -42,6 +42,7 @@ func _ready(): _move_camera_to_initial_position() if settings.visibility == settings.Visibility.FULL: fog_of_war.reveal() + MatchSignals.match_started.emit() func _unhandled_input(event): diff --git a/source/match/MatchConstants.gd b/source/match/MatchConstants.gd index 1ce08c8..4f9a809 100644 --- a/source/match/MatchConstants.gd +++ b/source/match/MatchConstants.gd @@ -219,9 +219,17 @@ class Units: class VoiceNarrator: enum Events { + MATCH_STARTED, + MATCH_ABORTED, UNIT_LOST, + UNIT_PRODUCTION_STARTED, + NOT_ENOUGH_RESOURCES, } const EVENT_TO_ASSET_MAPPING = { + Events.MATCH_STARTED: preload("res://assets/voice/english/battle_control_online.ogg"), + Events.MATCH_ABORTED: preload("res://assets/voice/english/battle_control_offline.ogg"), Events.UNIT_LOST: preload("res://assets/voice/english/unit_lost.ogg"), + Events.UNIT_PRODUCTION_STARTED: preload("res://assets/voice/english/training.ogg"), + Events.NOT_ENOUGH_RESOURCES: preload("res://assets/voice/english/not_enough_resources.ogg"), } diff --git a/source/match/MatchSignals.gd b/source/match/MatchSignals.gd index 0de06d9..aa49a20 100644 --- a/source/match/MatchSignals.gd +++ b/source/match/MatchSignals.gd @@ -7,9 +7,13 @@ signal place_structure(structure_prototype) signal schedule_navigation_rebake(domain) # notifications +signal match_started +signal match_aborted signal terrain_targeted(position) signal unit_spawned(unit) signal unit_targeted(unit) signal unit_selected(unit) signal unit_deselected(unit) signal unit_died(unit) +signal unit_production_started(unit_prototype, producer_unit) +signal not_enough_resources_for_production(player) diff --git a/source/match/Menu.gd b/source/match/Menu.gd index 801969b..0c1eb7a 100644 --- a/source/match/Menu.gd +++ b/source/match/Menu.gd @@ -23,5 +23,7 @@ func _on_resume_button_pressed(): func _on_exit_button_pressed(): + MatchSignals.match_aborted.emit() + await get_tree().create_timer(1.74).timeout # Give voice narrator some time to finish. get_tree().paused = false get_tree().change_scene_to_file("res://source/main-menu/Main.tscn") diff --git a/source/match/players/human/Human.tscn b/source/match/players/human/Human.tscn index 0578764..b5724b1 100644 --- a/source/match/players/human/Human.tscn +++ b/source/match/players/human/Human.tscn @@ -18,3 +18,4 @@ script = ExtResource("1_m624e") script = ExtResource("4_ljr74") [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="VoiceNarratorController"] +process_mode = 3 diff --git a/source/match/players/human/VoiceNarratorController.gd b/source/match/players/human/VoiceNarratorController.gd index 26eece9..02d5392 100644 --- a/source/match/players/human/VoiceNarratorController.gd +++ b/source/match/players/human/VoiceNarratorController.gd @@ -4,7 +4,17 @@ extends Node func _ready(): + MatchSignals.match_started.connect( + _handle_event.bind(Constants.Match.VoiceNarrator.Events.MATCH_STARTED) + ) + MatchSignals.match_aborted.connect( + _handle_event.bind(Constants.Match.VoiceNarrator.Events.MATCH_ABORTED) + ) MatchSignals.unit_died.connect(_on_unit_died) + MatchSignals.unit_production_started.connect(_on_production_started) + MatchSignals.not_enough_resources_for_production.connect( + _on_not_enough_resources_for_production + ) func _handle_event(event): @@ -15,3 +25,13 @@ func _handle_event(event): func _on_unit_died(unit): if unit.is_in_group("controlled_units"): _handle_event(Constants.Match.VoiceNarrator.Events.UNIT_LOST) + + +func _on_production_started(_unit_prototype, producer_unit): + if producer_unit.is_in_group("controlled_units"): + _handle_event(Constants.Match.VoiceNarrator.Events.UNIT_PRODUCTION_STARTED) + + +func _on_not_enough_resources_for_production(player): + if player == get_parent(): + _handle_event(Constants.Match.VoiceNarrator.Events.NOT_ENOUGH_RESOURCES) diff --git a/source/match/units/traits/ProductionQueue.gd b/source/match/units/traits/ProductionQueue.gd index 13630b9..6ef2acd 100644 --- a/source/match/units/traits/ProductionQueue.gd +++ b/source/match/units/traits/ProductionQueue.gd @@ -47,6 +47,7 @@ func produce(unit_prototype, ignore_limit = false): return var production_cost = Constants.Match.Units.PRODUCTION_COSTS[unit_prototype.resource_path] if not _unit.player.has_resources(production_cost): + MatchSignals.not_enough_resources_for_production.emit(_unit.player) return _unit.player.subtract_resources(production_cost) var queue_element = ProductionQueueElement.new() @@ -54,6 +55,7 @@ func produce(unit_prototype, ignore_limit = false): queue_element.time_total = Constants.Match.Units.PRODUCTION_TIMES[unit_prototype.resource_path] queue_element.time_left = Constants.Match.Units.PRODUCTION_TIMES[unit_prototype.resource_path] _enqueue_element(queue_element) + MatchSignals.unit_production_started.emit(unit_prototype, _unit) func cancel_all():