/// <summary> /// play next queued clip /// </summary> private void NextQueue() { Debug.Assert(this.initialized, "SimplestAnimation don't be initialized !"); ClipQueue next = this.clipQueue.Dequeue(); var nextIndex = this.actInputIndex ^ 0x01; this.clipIndex = next.clipIndex; this.clipDuration = this.animations[next.clipIndex].length; this.wrapMode = this.animations[this.clipIndex].wrapMode; this.mixer.ConnectInput(nextIndex, this.clips[this.clipIndex], 0); this.mixer.SetInputWeight(nextIndex, 0f); this.state = STATE.BLEND; this.remainingTime = this.targetTime = next.blendTime; this.clips[this.clipIndex].SetTime(0f); }
/// <summary> /// queue next clip /// </summary> /// <param name="clipIndex">playing clip No.</param> /// <param name="blendTime">time for blending (sec.)</param> public void PlayQueued(int clipIndex, float blendTime = 0f) { Debug.Assert(this.initialized, "SimplestAnimation don't be initialized !"); if (this.state == STATE.NONE || this.wrapMode == WrapMode.Loop) { this.Play(clipIndex, blendTime); return; } var queue = new ClipQueue() { clipIndex = clipIndex, blendTime = blendTime }; this.clipQueue.Enqueue(queue); if (this.state == STATE.PLAY) { this.state = STATE.QUEUE; } }