纳金网

标题: 脚本 骨骼动画的暂停 [打印本页]

作者: 比巴卜    时间: 2013-4-28 08: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;
                }
        }




[url=][/url][url=][/url][url=][/url]



作者: 狂风大尉    时间: 2013-4-28 13:24
感谢分享,如果有注释会更好
作者: 筱筱    时间: 2013-5-2 11:08
谢谢楼主分享!




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5