找回密码
 立即注册
查看: 4307|回复: 70

[脚本] 骨骼动画的暂停

[复制链接]
发表于 2013-4-26 11:56 | 显示全部楼层 |阅读模式
昨天遇到一个骨骼动画暂停的问题,没有解决,有位网友告诉了一个思路 今天做出来了 分享给大家!吼吼吼

void  Start()
        {
                animation.Stop();
                animation.wrapMode=WrapMode.Once;
        }
       
        void Update()
        {
               
        }
       
        void OnGUI()
        {
                if(GUI.Button(new Rect(0,0,65,25),"Start"))
                {
                   if(!animation.isPlaying)
                   {
                                Debug.Log(" start of  playing");
                                animation["AnimationName"].speed=1;
                            animation.Play();
                        }
                       
                        if(animation["AnimationName"].speed==0)
                        {
                                Debug.Log("start of stop");
                                animation["AnimationName"].speed=1;
                            animation.Play();
                        }
                       
                }
               
                if(GUI.Button(new Rect(0,50,65,25),"Pause"))                       
                {
                        if(animation.isPlaying)
                        {
                          Debug.Log("pause of playing");       
                        }
                        else
                        {
                                Debug.Log("pause of  stop");
                        }
                        animation["AnimationName"].speed=0;
                }
        }

发表于 2017-2-18 20:59 | 显示全部楼层
很不错
发表于 2017-2-18 21:35 | 显示全部楼层
好帖就是要顶
发表于 2017-2-18 20:53 | 显示全部楼层
顶顶多好
发表于 2017-2-18 21:49 | 显示全部楼层
说的非常好
发表于 2017-2-18 21:32 | 显示全部楼层
不错不错
发表于 2017-5-7 11:16 | 显示全部楼层
很不错
发表于 2017-5-7 11:19 | 显示全部楼层
好帖就是要顶
发表于 2017-5-7 11:42 | 显示全部楼层
说的非常好
发表于 2017-5-7 11:38 | 显示全部楼层
很好哦
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-29 13:05 , Processed in 0.098059 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表