public void Play(Dialogue newDialogue) { MissionCanvas.SetActive(true); if (isPlaying)//if something is already playing, play a new one { StopDialogue(); } myDialogue = newDialogue; missionText.text = myDialogue.text; myAudio = myDialogue.audio; if (myAudio == null) { hasVoice = false; currentPlayTime = maxPlayTime; } else { hasVoice = true; } StartDialogue(); }
//add any elements as needed, panning/doppler effect ect public void Awake() { sfxSource = this.gameObject.AddComponent <STAudioSource>(); sfxSource.playOnAwake = false; sfxSource.priority = priority; sfxSource.maxDistance = maxDistance; }
void Awake() { myRawImage = GetComponent <RawImage>(); myAudio = GetComponent <STAudioSource>(); }