void HandleOneshot(BlendClip clip, float time, float lastTime) { float anchor = Mathf.Lerp(clip.start, clip.end, clip.oneshotAnchor); if (!clip.isPlaying) { if ((lastTime < anchor && time >= anchor) || (lastTime > anchor && time <= anchor)) { clip.Play(0f); } } else { clip.HandleVolume(sequence.fade * sequence.volume * sequence.blender.masterVolume * panBlend, clip.source.time / clip.audioClip.length * volume); clip.HandlePitch(sequence.pitch * sequence.blender.masterPitch, clip.source.time / clip.audioClip.length); } }
void HandleClip(BlendClip clip, float time) { float percent = 0f; if (clip.Evaluate(time, out percent)) { if (!clip.isPlaying) { clip.Play(percent); } clip.HandleVolume(sequence.fade * sequence.volume * sequence.blender.masterVolume * panBlend * volume, percent); clip.HandlePitch(sequence.pitch * sequence.blender.masterPitch, percent); } else { if (clip.isPlaying) { clip.Pause(); } } }