Skip to content

Commit

Permalink
Quest: Added audio to play.
Browse files Browse the repository at this point in the history
Quest Resource:
- Quest Audio offers a spot to add audio that plays when quest status changes (start, complete, failed)
- Added audio to QuestA from the Legacy Demo scene to show this.
  • Loading branch information
Phazorknight committed Oct 16, 2024
1 parent b93e355 commit c406d82
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 3 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://b88d1i6sdt33e"
path="res://.godot/imported/mission_completed.ogg-28ff19a7531b3490143752c6e597b89c.oggvorbisstr"

[deps]

source_file="res://addons/cogito/Assets/Audio/Kenney/VoiceFemale/mission_completed.ogg"
dest_files=["res://.godot/imported/mission_completed.ogg-28ff19a7531b3490143752c6e597b89c.oggvorbisstr"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://dk2oy5fliyxur"
path="res://.godot/imported/mission_failed.ogg-16c758f59fdf994ca515d493034f47d2.oggvorbisstr"

[deps]

source_file="res://addons/cogito/Assets/Audio/Kenney/VoiceFemale/mission_failed.ogg"
dest_files=["res://.godot/imported/mission_failed.ogg-16c758f59fdf994ca515d493034f47d2.oggvorbisstr"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
Binary file not shown.
19 changes: 19 additions & 0 deletions addons/cogito/Assets/Audio/Kenney/VoiceFemale/ready.ogg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://c02tkljgvmiaa"
path="res://.godot/imported/ready.ogg-caf16e6907b2063be74232dc311e64ea.oggvorbisstr"

[deps]

source_file="res://addons/cogito/Assets/Audio/Kenney/VoiceFemale/ready.ogg"
dest_files=["res://.godot/imported/ready.ogg-caf16e6907b2063be74232dc311e64ea.oggvorbisstr"]

[params]

loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
4 changes: 2 additions & 2 deletions addons/cogito/DemoScenes/COGITO_1_LegacyDemo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ size = Vector3(1.5, 0.01, 1.5)
[sub_resource type="BoxShape3D" id="BoxShape3D_ht4uj"]
size = Vector3(100, 3, 100)

[sub_resource type="Resource" id="Resource_fmb0d"]
[sub_resource type="Resource" id="Resource_o0bgl"]
resource_local_to_scene = true
script = ExtResource("2_chxar")
grid = true
Expand Down Expand Up @@ -1634,7 +1634,7 @@ spawn_on_death = Array[PackedScene]([])

[node name="Player" parent="." instance=ExtResource("1_7d2n7")]
transform = Transform3D(-1, 0, 7.45058e-07, 0, 1, 0, -7.45058e-07, 0, -1, -7.5375, 0.905039, -3.30884)
inventory_data = SubResource("Resource_fmb0d")
inventory_data = SubResource("Resource_o0bgl")
step_height_camera_lerp = 1.5

[node name="Ladder" parent="." instance=ExtResource("41_q27ev")]
Expand Down
12 changes: 12 additions & 0 deletions addons/cogito/QuestSystem/CustomResources/cogito_quest.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class_name CogitoQuest
@export var quest_counter_current : int = 0
@export var quest_counter_goal : int


@export_group("Quest Audio")
@export var audio_on_start: AudioStream
@export var audio_on_complete: AudioStream
@export var audio_on_fail: AudioStream

var quest_description : String

var quest_completed : bool = false:
Expand All @@ -33,6 +39,8 @@ var quest_counter : int:


func start():
if audio_on_start:
Audio.play_sound(audio_on_start)
quest_description = quest_description_active


Expand All @@ -41,8 +49,12 @@ func update() -> void:


func complete():
if audio_on_complete:
Audio.play_sound(audio_on_complete)
quest_description = quest_description_completed


func failed():
if audio_on_fail:
Audio.play_sound(audio_on_fail)
quest_description = quest_description_failed
8 changes: 7 additions & 1 deletion addons/cogito/QuestSystem/Quests/QuestA.tres
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
[gd_resource type="Resource" script_class="CogitoQuest" load_steps=2 format=3 uid="uid://yb7k8evveqdp"]
[gd_resource type="Resource" script_class="CogitoQuest" load_steps=5 format=3 uid="uid://yb7k8evveqdp"]

[ext_resource type="AudioStream" uid="uid://b88d1i6sdt33e" path="res://addons/cogito/Assets/Audio/Kenney/VoiceFemale/mission_completed.ogg" id="1_cbdma"]
[ext_resource type="Script" path="res://addons/cogito/QuestSystem/CustomResources/cogito_quest.gd" id="1_t4vbj"]
[ext_resource type="AudioStream" uid="uid://dk2oy5fliyxur" path="res://addons/cogito/Assets/Audio/Kenney/VoiceFemale/mission_failed.ogg" id="2_s4ily"]
[ext_resource type="AudioStream" uid="uid://c02tkljgvmiaa" path="res://addons/cogito/Assets/Audio/Kenney/VoiceFemale/ready.ogg" id="3_titwm"]

[resource]
script = ExtResource("1_t4vbj")
Expand All @@ -12,3 +15,6 @@ quest_description_completed = "You completed this quest."
quest_description_failed = "You failed this quest."
quest_counter_current = 0
quest_counter_goal = 0
audio_on_start = ExtResource("3_titwm")
audio_on_complete = ExtResource("1_cbdma")
audio_on_fail = ExtResource("2_s4ily")

0 comments on commit c406d82

Please sign in to comment.