Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
using UnityEngine;
using System.Collections;
public class PlayVideo : MonoBehaviour
{
public MovieTexture mov;
public static bool startPlay = false;
private float leftTime;
// Use this for initialization
void Start ()
{
mov = Resources.Load("video")as MovieTexture;
mov.loop = true;
leftTime = mov.duration;
Debug.Log("time:"+mov.duration);
}
// Update is called once per frame
void Update ()
{
if(PlayVideo.startPlay)
{
if(PlayerPrefs.GetInt("PlayerFinishedLevel",0)>0)
{
PlayVideo.startPlay = false;
return;
}
if(leftTime<=0)
{
PlayVideo.startPlay = false;
Application.LoadLevelAsync("intro");
}
else leftTime-=Time.deltaTime;
}
}
void OnGUI()
{
if(PlayVideo.startPlay)
{
if(PlayerPrefs.GetInt("PlayerFinishedLevel",0)>0)
{
PlayVideo.startPlay = false;
return;
}
//绘制电影纹理
GUI.DrawTexture (new Rect (0,0, Screen.width, Screen.height),mov,ScaleMode.StretchToFill);
if(!mov.isPlaying)
{
mov.Play();
}
}
}
}
|
Revision |
Author |
Commited |
Message |
165
Diff
|
GGORDON2
|
Mon 06 Apr, 2015 02:43:47 +0000 |
|
163
|
GGORDON2
|
Wed 25 Mar, 2015 19:18:10 +0000 |
|