返回介绍

Animation.PlayQueued 播放队列

发布于 2019-12-18 15:37:09 字数 4404 浏览 1141 评论 0 收藏 0

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

C# => public AnimationState PlayQueued(string animation, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);
C# => public AnimationState PlayQueued(string animation, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);
C# => public AnimationState PlayQueued(string animation, QueueMode queue = QueueMode.CompleteOthers, PlayMode mode = PlayMode.StopSameLayer);

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.

当动画完成播放之后,它会自动清理。在一个动画状态结束之后使用它,将会导致一个异常。

JavaScript:

var anim: Animation;
 
function Start() {
	anim = GetComponent.<Animation>();
}
 
 
function Update () {
	if (Input.GetButtonDown("Fire1"))	
		anim.PlayQueued("shoot", QueueMode.PlayNow);
}

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleClass : MonoBehaviour {
    public Animation anim;
    void Start() {
        anim = GetComponent<Animation>();
    }
    void Update() {
        if (Input.GetButtonDown("Fire1"))
            anim.PlayQueued("shoot", QueueMode.PlayNow);
 
    }
}

Animation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文