- 最后登录
- 2016-8-29
- 注册时间
- 2012-8-25
- 阅读权限
- 90
- 积分
- 23585
- 纳金币
- 20645
- 精华
- 62
|
- #pragma strict
-
- var StartingMovie:MovieTexture;
-
- function Start ()
-
- {
-
- renderer.material.mainTexture = StartingMovie;
-
- StartingMovie.loop=true;//循环播放
-
- StartingMovie.Play();//若初始化想直接播放视频就写改代码,通过点击按钮或者碰撞时才播放可不写此代码
-
- }
-
- function Update ()
-
- {
-
- }
-
- //碰撞时播放视频,离开时关闭视频用下面的代码
-
- function OnTriggerEnter()
-
- {
-
- StartingMovie.Play();
-
- }
-
- function OnTriggerExit()
-
- {
-
- StartingMovie.Stop();
-
- }
-
- //点击GUI按钮播放视频
-
- function OnGUI(){
-
- if(GUI.Button(Rect(0,70,65,20),“播放/继续”))
-
- {
-
- if(!StartingMovie.isPlaying)
-
- {
-
- StartingMovie.Play();
-
- sound.Play();
-
- }
-
- }
复制代码 |
|