Created
November 8, 2014 01:05
-
-
Save prime31/90988bb3ce5f7f63d559 to your computer and use it in GitHub Desktop.
TransitionKit demo scene code. The basic idea is that the transitionWithDelegate method takes in an object that handles the transitions. This can be a standard class or a MonoBehaviour subclass (so that you can modify properties in the inspector) as in the third button. Transitions can change scenes if they want to or just obscure the current sc…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void OnGUI() | |
{ | |
if( GUILayout.Button( "Fade to Scene" ) ) | |
{ | |
var scene = Application.loadedLevel == 0 ? 1 : 0; | |
TransitionKit.transitionWithDelegate( new FadeTransition( Color.black, 0.5f, 0.2f, scene ) ); | |
} | |
if( GUILayout.Button( "Pixelate to Scene with Random Scale Effect" ) ) | |
{ | |
var scene = Application.loadedLevel == 0 ? 1 : 0; | |
var enumValues = System.Enum.GetValues( typeof( PixelateTransition.PixelateFinalScaleEffect ) ); | |
var randomScaleEffect = (PixelateTransition.PixelateFinalScaleEffect)enumValues.GetValue( Random.Range( 0, enumValues.Length ) ); | |
TransitionKit.transitionWithDelegate( new PixelateTransition( 0.5f, 0.2f, randomScaleEffect, scene ) ); | |
} | |
if( GUILayout.Button( "Twirl via Component" ) ) | |
{ | |
GetComponent<TwirlTransition>().nextScene = Application.loadedLevel == 0 ? 1 : 0; | |
TransitionKit.transitionWithDelegate( GetComponent<TwirlTransition>() ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment