Animation.PlayQueued 播放队列

function PlayQueued (animation : string, queue : QueueMode = QueueMode.CompleteOthers, mode : PlayMode = PlayMode.StopSameLayer) : AnimationState

Description描述

Plays an animation after previous animations has finished playing.
在前一个动画播放完成之后直接播放下一个动画。

For example you might play a specific sequeue of animations after each other.
比如你可能会一个接一个播放一个特殊序列的动画。

The animation state duplicates itself before playing thus you can fade between the same animation. This can be used to overlay two same animations. For example you might have a sword swing animation. The player slashes two times quickly after each other. You could rewind the animation and play from the beginning but then you will get a jump in the animation.
动画状态在播放之前会复制自己,因此你可以在相同的动画之间进行淡入淡出。这个可以用于覆盖两个相同的动画。比如你可能有一个剑挥舞的动画,玩家连续快速削两次。你可以倒播这个动画然后从头再播放但是你会看到动画之间有跳越现象。

The following queue modes are available:
If queue is QueueMode.CompleteOthers this animation will only start once all other animations have stopped playing.
If queue is QueueMode.PlayNow this animation will start playing immediately on a duplicated animation state.
下面几个模式可用:
如果queue是QueueMode.CompleteOthers,当所有其他动画停止播放,这个动画才会开始。
如果queue是QueueMode.PlayNow,这个动画将在一个重复的动画状态下立即开始播放。

After the animation has finished playing it will automatically clean itself up. Using the duplicated animation state after it has finished will result in an exception.
当动画完成播放之后,它会自动清理。在一个动画状态结束之后使用它,将会导致一个异常。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Update() {
		if (Input.GetButtonDown("Fire1"))
			animation.PlayQueued("shoot", QueueMode.PlayNow);

	}
}
function Update () {
	if (Input.GetButtonDown("Fire1"))
		animation.PlayQueued("shoot", QueueMode.PlayNow);
}
最后修改:2011年4月6日 Wednesday 11:43

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。