Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var t : float = 0.0;
- var currentT : float;
- var darken = false;
- var movie1 : MovieTexture;
- var sound1 : AudioSource;
- var blackImage : Texture2D;
- var videoPlaying = true;
- var gui : GUITexture;
- var colors = [Color.white, Color.black];
- function Update ()
- {
- if(Input.GetKeyDown(KeyCode.Space)) Darken();
- guiTexture.pixelInset = Rect(-Screen.width/2,-Screen.height/2,Screen.width,Screen.height);
- }
- function Darken()
- {
- if(videoPlaying)
- {
- videoPlaying = false;
- guiTexture.texture = movie1;
- colors = [Color.white, Color.black];
- yield Fade.use.Alpha(gui.guiTexture, 0.0, 1.0, 2.0, EaseType.InOut);
- movie1.Play();
- sound1.Play();
- yield Fade.use.Colors(gui.guiTexture, Color.black, Color(255,255,255), 1.0);
- Time.timeScale=0;
- }
- else
- {
- Time.timeScale=1;
- videoPlaying = true;
- movie1.Pause();
- sound1.Pause();
- colors = [Color.white, Color.black];
- yield Fade.use.Colors(gui.guiTexture, Color.white, Color.black, 1.0);
- guiTexture.texture = blackImage;
- yield Fade.use.Alpha(gui.guiTexture, 1.0, 0.0, 2.0, EaseType.InOut);
- yield WaitForSeconds(2.0);
- }
- }
Add Comment
Please, Sign In to add comment