diff --git a/Assets/Animations/DialogueBox_Close.anim b/Assets/Animations/DialogueBox_Close.anim index 03c3afe..a34dee9 100644 --- a/Assets/Animations/DialogueBox_Close.anim +++ b/Assets/Animations/DialogueBox_Close.anim @@ -63,15 +63,6 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: 1 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 0.13333334 value: 0 inSlope: Infinity outSlope: Infinity @@ -123,6 +114,25 @@ AnimationClip: path: Text Bubble classID: 114 script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Character Text + classID: 1 + script: {fileID: 0} m_PPtrCurves: [] m_SampleRate: 60 m_WrapMode: 0 @@ -152,6 +162,13 @@ AnimationClip: typeID: 114 customType: 24 isPPtrCurve: 0 + - serializedVersion: 2 + path: 983765927 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 - serializedVersion: 2 path: 983765927 attribute: 3 @@ -327,15 +344,6 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: 1 - inSlope: Infinity - outSlope: Infinity - tangentMode: 103 - weightedMode: 0 - inWeight: 0 - outWeight: 0 - - serializedVersion: 3 - time: 0.13333334 value: 0 inSlope: Infinity outSlope: Infinity @@ -387,6 +395,25 @@ AnimationClip: path: Text Bubble classID: 114 script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Character Text + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Animations/DialogueBox_Open.anim b/Assets/Animations/DialogueBox_Open.anim index 1316a7b..04bfbe8 100644 --- a/Assets/Animations/DialogueBox_Open.anim +++ b/Assets/Animations/DialogueBox_Open.anim @@ -142,6 +142,25 @@ AnimationClip: path: Text Bubble classID: 114 script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Character Text + classID: 1 + script: {fileID: 0} m_PPtrCurves: [] m_SampleRate: 60 m_WrapMode: 0 @@ -185,6 +204,13 @@ AnimationClip: typeID: 114 customType: 24 isPPtrCurve: 0 + - serializedVersion: 2 + path: 983765927 + attribute: 2086281974 + script: {fileID: 0} + typeID: 1 + customType: 0 + isPPtrCurve: 0 pptrCurveMapping: [] m_AnimationClipSettings: serializedVersion: 2 @@ -450,6 +476,25 @@ AnimationClip: path: Text Bubble classID: 114 script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: Infinity + outSlope: Infinity + tangentMode: 103 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_IsActive + path: Character Text + classID: 1 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Scenes/Mountain.unity b/Assets/Scenes/Mountain.unity index 9be6926..c7a4133 100644 --- a/Assets/Scenes/Mountain.unity +++ b/Assets/Scenes/Mountain.unity @@ -882,9 +882,15 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: dialogue: - sentences: + Sentences: - hey dude - just testing stuff out + SoundEffect: + audioClip: {fileID: 8300000, guid: cde99aa876cd4a948a9f0ab587d8254f, type: 3} + pitchMin: 1 + pitchMax: 1 + volumeMin: 1 + volumeMax: 1 --- !u!114 &514570066 MonoBehaviour: m_ObjectHideFlags: 0 @@ -2575,11 +2581,6 @@ GameObject: m_CorrespondingSourceObject: {fileID: -7146521406498821007, guid: 48d872dde42d8a8479d845c6b3fb3518, type: 3} m_PrefabInstance: {fileID: 1614487504} m_PrefabAsset: {fileID: 0} ---- !u!1 &1614487508 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 65702495048144492, guid: 48d872dde42d8a8479d845c6b3fb3518, type: 3} - m_PrefabInstance: {fileID: 1614487504} - m_PrefabAsset: {fileID: 0} --- !u!64 &1614487509 MeshCollider: m_ObjectHideFlags: 0 @@ -2640,14 +2641,6 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 0 m_CollisionDetection: 0 ---- !u!81 &1614487513 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1614487508} - m_Enabled: 1 --- !u!1 &1620235925 GameObject: m_ObjectHideFlags: 0 @@ -2800,6 +2793,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 2082500391} m_Modifications: + - target: {fileID: 36671747401237298, guid: 8ceeae119e95aeb46b0ece6d23daffbd, type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3584299649024768172, guid: 8ceeae119e95aeb46b0ece6d23daffbd, type: 3} propertyPath: m_RootOrder value: 0 @@ -2852,6 +2849,10 @@ PrefabInstance: propertyPath: m_Enabled value: 0 objectReference: {fileID: 0} + - target: {fileID: 9106198387064842738, guid: 8ceeae119e95aeb46b0ece6d23daffbd, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 8ceeae119e95aeb46b0ece6d23daffbd, type: 3} --- !u!4 &1631886794 stripped @@ -3378,11 +3379,6 @@ GameObject: m_CorrespondingSourceObject: {fileID: -8391222552659086748, guid: bfd7d3a6fef198440ba822090afd086d, type: 3} m_PrefabInstance: {fileID: 1996453966} m_PrefabAsset: {fileID: 0} ---- !u!1 &1996453969 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 65702495048144492, guid: bfd7d3a6fef198440ba822090afd086d, type: 3} - m_PrefabInstance: {fileID: 1996453966} - m_PrefabAsset: {fileID: 0} --- !u!64 &1996453970 MeshCollider: m_ObjectHideFlags: 0 @@ -3413,14 +3409,6 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 0 m_CollisionDetection: 0 ---- !u!81 &1996453972 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1996453969} - m_Enabled: 1 --- !u!20 &1996453977 stripped Camera: m_CorrespondingSourceObject: {fileID: -1853094968961178454, guid: bfd7d3a6fef198440ba822090afd086d, type: 3} diff --git a/Assets/Scripts/Dialogue/Dialogue.cs b/Assets/Scripts/Dialogue/Dialogue.cs index cd76dbc..435b99f 100644 --- a/Assets/Scripts/Dialogue/Dialogue.cs +++ b/Assets/Scripts/Dialogue/Dialogue.cs @@ -6,6 +6,9 @@ namespace Scampz.GameJam public class Dialogue { [TextArea(3, 10)] - public string[] sentences; + public string[] Sentences; + + [SerializeField] + public SFXClip SoundEffect; } } diff --git a/Assets/Scripts/Dialogue/DialogueManager.cs b/Assets/Scripts/Dialogue/DialogueManager.cs index 7c65fbc..5e45317 100644 --- a/Assets/Scripts/Dialogue/DialogueManager.cs +++ b/Assets/Scripts/Dialogue/DialogueManager.cs @@ -9,12 +9,13 @@ using UnityEngine; namespace Scampz.GameJam { + [RequireComponent(typeof(TextMeshProUGUI))] public class DialogueManager : MonoBehaviour { [SerializeField] private Animator _animator; [SerializeField] - private TextMeshProUGUI dialogueTextGUI; + private TextMeshProUGUI _dialogueTextGUI; [SerializeField] private float _defaultTextSpeed = 0.1f; @@ -56,13 +57,20 @@ namespace Scampz.GameJam _animator.SetBool("IsOpen", true); IsTalking = true; sentences.Clear(); - foreach (var sentence in dialogue.sentences) + foreach (var sentence in dialogue.Sentences) sentences.Enqueue(sentence); - DisplayNextSentence(); + DisplayNextSentence(dialogue); } - public void DisplayNextSentence() + private IEnumerator PlayAudioCoroutine(SFXClip soundEffect) + { + yield return null; + SFXManager.Instance.PlaySoundEffect(soundEffect.audioClip.name); + yield return null; + } + + public void DisplayNextSentence(Dialogue dialogue) { if (!sentences.Any()) { @@ -71,34 +79,33 @@ namespace Scampz.GameJam return; } - SFXManager.Instance.PlaySoundEffect(SoundEffectName.Narration); - var sentence = sentences.Dequeue(); StopAllCoroutines(); - StartCoroutine(TypeSentence(sentence)); + StartCoroutine(TypeSentence(sentence, dialogue)); + StartCoroutine(nameof(PlayAudioCoroutine), dialogue.SoundEffect); } - private IEnumerator TypeSentence(string sentence) + private IEnumerator TypeSentence(string sentence, Dialogue dialogue) { - dialogueTextGUI.text = string.Empty; + _dialogueTextGUI.text = string.Empty; foreach (var letter in sentence.ToCharArray()) { - dialogueTextGUI.text += letter; + _dialogueTextGUI.text += letter; yield return null; yield return new WaitForSeconds(_currentTextSpeed); } yield return new WaitForSeconds(1f); - SFXManager.Instance.StopSoundEffect(); yield return new WaitForKeyDown(InputOptions.Submit); SFXManager.Instance.PlaySoundEffect(SoundEffectName.Ok); - DisplayNextSentence(); + DisplayNextSentence(dialogue); } private void EndDialogue() { _animator.SetBool("IsOpen", false); + _dialogueTextGUI.text = string.Empty; IsTalking = false; SFXManager.Instance.StopSoundEffect(); } diff --git a/Assets/Singleton/SingletonManager.prefab b/Assets/Singleton/SingletonManager.prefab index 466b380..3e2e5f3 100644 --- a/Assets/Singleton/SingletonManager.prefab +++ b/Assets/Singleton/SingletonManager.prefab @@ -318,6 +318,7 @@ GameObject: m_Component: - component: {fileID: 3584299649035273204} - component: {fileID: 3584299649035273207} + - component: {fileID: 7607175870710481519} m_Layer: 0 m_Name: BGM Manager m_TagString: Untagged @@ -353,6 +354,102 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _backgroundMusic: {fileID: 2471171845959243506, guid: bc4dd6e772668d64f95ce6ea28022290, type: 3} +--- !u!82 &7607175870710481519 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3584299649035273206} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 --- !u!1 &3584299649216310804 GameObject: m_ObjectHideFlags: 0 @@ -364,6 +461,8 @@ GameObject: - component: {fileID: 9048025182165106366} - component: {fileID: 3584299649216310802} - component: {fileID: 8281504758914613877} + - component: {fileID: 8072501972480730054} + - component: {fileID: 8471903887124514785} m_Layer: 0 m_Name: Dialogue Manager m_TagString: Untagged @@ -404,8 +503,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _animator: {fileID: 992122626} - dialogueTextGUI: {fileID: 36671747401237298} - _textSpeed: 0.1 + _dialogueTextGUI: {fileID: 36671747401237298} + _defaultTextSpeed: 0.1 IsTalking: 0 --- !u!82 &8281504758914613877 AudioSource: @@ -503,6 +602,103 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!222 &8072501972480730054 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3584299649216310804} + m_CullTransparentMesh: 1 +--- !u!114 &8471903887124514785 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3584299649216310804} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &3584299649380910130 GameObject: m_ObjectHideFlags: 0