public IEnumerator processQueue() { while (true) // TODO - Check "game running" flag { if (queue.Count == 0) { addGenericAnnouncementAfterDelay(); } Tuple2 <float, AudioClip> firstInQueue = queue.First <Tuple2 <float, AudioClip> >(); float waitTimeForFirstInQueue = firstInQueue.First; float iterationWaitTime = Mathf.Min(waitTimeForFirstInQueue, 1f); if (iterationWaitTime > 0) { // Debug.Log(firstInQueue.First + "s : " + firstInQueue.Second.name); firstInQueue.First -= iterationWaitTime; yield return(new WaitForSeconds(iterationWaitTime)); } else { // Play audio queue.Remove(firstInQueue); List <AudioClip> otherParts = getAdditionalPartsForAudioClip(firstInQueue.Second); yield return(loudspeaker.spawn(firstInQueue.Second, otherParts)); clearMemory(); } } }
public void buttonToggled(string name) { ToggleMaterial material; Enum.TryParse(name, out material); bool pressed; if (XRAY_MATERIALS_VISIBLE.Contains(material)) { pressed = false; XRAY_MATERIALS_VISIBLE.Remove(material); } else { pressed = true; XRAY_MATERIALS_VISIBLE.Add(material); } PubSub.publish("xray_button_toggle"); soundObject.spawn(pressed ? buttonPressClip : buttonDepressClip); }
private Coroutine playVoice(AudioClip clip) { return(soundObject.spawn(clip)); }