かっこいい画面遷移

www.youtube.com
www.reddit.com
http://i.imgur.com/61jkcqa.gif

using UnityEngine;
using System.Collections;


//Attach this to a camera
public class CameraScreenGrab : MonoBehaviour {

	//how chunky to make the screen
	public float pixelSize = 0;
	public FilterMode filterMode = FilterMode.Point;
	public Camera[] otherCameras;
	private Material mat;
	Texture2D tex;

	public static CameraScreenGrab instance = null;
	void Awake(){
		if(instance == null){
			instance = this;
		}

	}
	void Start () {
		camera.pixelRect = new Rect(0,0,Screen.width/pixelSize,Screen.height/pixelSize);
		for (int i = 0; i < otherCameras.Length; i++)
			otherCameras[i].pixelRect = new Rect(0,0,Screen.width/pixelSize,Screen.height/pixelSize);
	}
	void Update(){
		camera.pixelRect = new Rect(0,0,Screen.width/pixelSize,Screen.height/pixelSize);
		for (int i = 0; i < otherCameras.Length; i++)
			otherCameras[i].pixelRect = new Rect(0,0,Screen.width/pixelSize,Screen.height/pixelSize);

	}


	void OnGUI()
	{
		if (Event.current.type == EventType.Repaint)
			Graphics.DrawTexture(new Rect(0,0,Screen.width, Screen.height), tex);
	}


	void OnPostRender()
	{
		//matがfalseだったら
		if(!mat) {
			mat = new Material( "Shader \"Hidden/SetAlpha\" {" +
				"SubShader {" +
				"	Pass {" +
				"		ZTest Always Cull Off ZWrite Off" +
				"		ColorMask A" +
				"		Color (1,1,1,1)" +
				"	}" +
				"}" +
				"}"
			);
		}
		// Draw a quad over the whole screen with the above shader
		GL.PushMatrix ();
		GL.LoadOrtho ();
		for (var i = 0; i < mat.passCount; ++i) {
			mat.SetPass (i);
			GL.Begin( GL.QUADS );
			GL.Vertex3( 0, 0, 0.1f );
			GL.Vertex3( 1, 0, 0.1f );
			GL.Vertex3( 1, 1, 0.1f );
			GL.Vertex3( 0, 1, 0.1f );
			GL.End();
		}
		GL.PopMatrix ();	


		DestroyImmediate(tex);

		tex = new Texture2D(Mathf.FloorToInt(camera.pixelWidth), Mathf.FloorToInt(camera.pixelHeight));
		tex.filterMode = filterMode;
		tex.ReadPixels(new Rect(0, 0, camera.pixelWidth, camera.pixelHeight), 0, 0);
		tex.Apply();
	}

}
using UnityEngine;
using System.Collections;

public class MovePlayScreen : MonoBehaviour {

	public Camera mainCamera;
	public float orthographicSize;
	public bool ZoomDone = false;
	public bool OnZoom = false;

	float PixelSize;
	public bool PixelDone = false;
	public bool OnPixel = false;


	public static MovePlayScreen instance = null;
	void Awake(){
		if(instance == null){
			instance = this;
		}

	}


	public void ZoomScreen(){
		if(OnZoom){
			if (2f < orthographicSize) {
				orthographicSize -= Time.deltaTime * 15f;
				mainCamera.camera.orthographicSize = orthographicSize;


			} else {
				OnZoom = false;
				ZoomDone = true;

			}
			if(ZoomDone){
				if(!GameManager.instance.Play){
					StartCoroutine(GameManager.instance.PlaybuttonOnWait());
				}
			}
		}
	}
	public bool Topixel = true;
	public void pixelSceen(){
		if(OnPixel){
			if (Topixel) {
				if (30f > PixelSize) {
					PixelSize = CameraScreenGrab.instance.pixelSize;
					PixelSize += Time.deltaTime * 20f;
					CameraScreenGrab.instance.pixelSize = PixelSize;

				} else {
					Topixel = false;
				}
			}
			if (!Topixel) {
				if (0 < PixelSize) {
					PixelSize = CameraScreenGrab.instance.pixelSize;
					PixelSize -= Time.deltaTime * 20f;
					CameraScreenGrab.instance.pixelSize = PixelSize;
					if (5 > PixelSize) {
					}

				} else {

					PixelDone = true;
					Topixel = false;
					OnPixel = false;

				}
			}
			if(PixelDone){
				if(!GameManager.instance.Play){
					StartCoroutine(GameManager.instance.PlaybuttonOnWait());
				}
			}
		}
	}
}