Skip to content

Instantly share code, notes, and snippets.

@prime31
Created November 8, 2014 01:05
Show Gist options
  • Save prime31/90988bb3ce5f7f63d559 to your computer and use it in GitHub Desktop.
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…
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