Finally, priority VO
This commit is contained in:
@@ -6,11 +6,12 @@ using Core;
|
||||
using Interactions;
|
||||
using UnityEngine;
|
||||
using PuzzleS;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
namespace Dialogue
|
||||
{
|
||||
[AddComponentMenu("AppleHills/Dialogue/Dialogue Component")]
|
||||
[RequireComponent(typeof(AudioSource))]
|
||||
[RequireComponent(typeof(AppleAudioSource))]
|
||||
public class DialogueComponent : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private RuntimeDialogueGraph dialogueGraph;
|
||||
@@ -19,7 +20,7 @@ namespace Dialogue
|
||||
private int currentLineIndex;
|
||||
private bool initialized = false;
|
||||
private SpeechBubble speechBubble;
|
||||
private AudioSource audioSource;
|
||||
private AppleAudioSource appleAudioSource;
|
||||
|
||||
// Flag to track when a condition has been met but dialogue hasn't advanced yet
|
||||
private bool _conditionSatisfiedPendingAdvance = false;
|
||||
@@ -37,7 +38,7 @@ namespace Dialogue
|
||||
private void Start()
|
||||
{
|
||||
// Get required components
|
||||
audioSource = GetComponent<AudioSource>();
|
||||
appleAudioSource = GetComponent<AppleAudioSource>();
|
||||
speechBubble = GetComponentInChildren<SpeechBubble>();
|
||||
|
||||
if (speechBubble == null)
|
||||
@@ -109,19 +110,19 @@ namespace Dialogue
|
||||
/// Play the audio clip for the current dialogue content
|
||||
/// </summary>
|
||||
/// <param name="clip">Audio clip to play</param>
|
||||
private void PlayDialogueAudio(AudioClip clip)
|
||||
private void PlayDialogueAudio(AudioResource clip)
|
||||
{
|
||||
// Stop any currently playing audio
|
||||
if (audioSource.isPlaying)
|
||||
if (appleAudioSource.audioSource.isPlaying)
|
||||
{
|
||||
audioSource.Stop();
|
||||
appleAudioSource.Stop();
|
||||
}
|
||||
|
||||
// Play the new clip if it exists
|
||||
if (clip != null)
|
||||
{
|
||||
audioSource.clip = clip;
|
||||
audioSource.Play();
|
||||
appleAudioSource.audioSource.resource = clip;
|
||||
appleAudioSource.Play();
|
||||
Logging.Debug($"Playing dialogue audio: {clip.name}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user