private NextClip GetNextClip() { for (int i = 0; i < 3; i++) { if (i > 0 && waitTimer > 0.0f) { // When waiting, skip all non-story lines return(null); } for (int j = 0; j < clipsToPlay.Count; j++) { NextClip clip = clipsToPlay[j]; if (clip.priority == (Priority)i) { Debug.Log($"Playing clip {clip.clip} at priority {clip.priority}"); clipsToPlay.RemoveAt(j); return(clip); } } } return(null); }
private void TriggerNextClip() { NextClip next = GetNextClip(); if (next != null) { source.Stop(); source.clip = clips[(int)next.clip]; source.Play(); SetEmotion(next.face); if (next.priority == Priority.STORY) { waitTimer = Random.Range(6.0f, 8.0f); } } else { SetEmotion(Emotion.NEUTRAL_HAPPY); } currentClip = next; }