Skip to content

Commit

Permalink
- added wind transition
Browse files Browse the repository at this point in the history
- moved all transitions into namespace
  • Loading branch information
prime31 committed Nov 9, 2014
1 parent c88bf3c commit a262158
Show file tree
Hide file tree
Showing 11 changed files with 542 additions and 396 deletions.
79 changes: 41 additions & 38 deletions Assets/Plugins/TransitionKit/transitions/BlurTransition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,61 @@
using Prime31.TransitionKit;


public class BlurTransition : TransitionKitDelegate
namespace Prime31.TransitionKit
{
public float duration = 0.5f;
public int nextScene = -1;
public float blurMin = 0.0f;
public float blurMax = 0.01f;
public class BlurTransition : TransitionKitDelegate
{
public float duration = 0.5f;
public int nextScene = -1;
public float blurMin = 0.0f;
public float blurMax = 0.01f;


#region TransitionKitDelegate implementation
#region TransitionKitDelegate implementation

public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Blur" );
}
public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Blur" );
}


public Mesh meshForDisplay()
{
return null;
}
public Mesh meshForDisplay()
{
return null;
}


public Texture2D textureForDisplay()
{
return null;
}
public Texture2D textureForDisplay()
{
return null;
}


public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;
public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

if( nextScene >= 0 )
Application.LoadLevelAsync( nextScene );
if( nextScene >= 0 )
Application.LoadLevelAsync( nextScene );

var elapsed = 0f;
while( elapsed < duration )
{
elapsed += Time.deltaTime;
var step = Mathf.Pow( elapsed / duration, 2f );
var blurAmount = Mathf.Lerp( blurMin, blurMax, step );
var elapsed = 0f;
while( elapsed < duration )
{
elapsed += Time.deltaTime;
var step = Mathf.Pow( elapsed / duration, 2f );
var blurAmount = Mathf.Lerp( blurMin, blurMax, step );

transitionKit.material.SetFloat( "_BlurSize", blurAmount );
transitionKit.material.SetFloat( "_BlurSize", blurAmount );

yield return null;
}
yield return null;
}

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}
// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}

#endregion
#endregion

}
}
}
82 changes: 42 additions & 40 deletions Assets/Plugins/TransitionKit/transitions/DoorwayTransition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,60 @@
using Prime31.TransitionKit;



/// <summary>
/// the Doorway shader can have _Progress run from 0 to -1 or 0 to 1. The runEffectInReverse controls that.
/// </summary>
public class DoorwayTransition : TransitionKitDelegate
namespace Prime31.TransitionKit
{
public float duration = 0.5f;
public int nextScene = -1;
public float perspective = 1.5f;
public float depth = 3.0f;
public bool runEffectInReverse = false;
/// <summary>
/// the Doorway shader can have _Progress run from 0 to -1 or 0 to 1. The runEffectInReverse controls that.
/// </summary>
public class DoorwayTransition : TransitionKitDelegate
{
public float duration = 0.5f;
public int nextScene = -1;
public float perspective = 1.5f;
public float depth = 3.0f;
public bool runEffectInReverse = false;


#region TransitionKitDelegate implementation
#region TransitionKitDelegate implementation

public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Doorway" );
}
public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Doorway" );
}


public Mesh meshForDisplay()
{
return null;
}
public Mesh meshForDisplay()
{
return null;
}


public Texture2D textureForDisplay()
{
return null;
}
public Texture2D textureForDisplay()
{
return null;
}


public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

// set some material properties
transitionKit.material.SetFloat( "_Perspective", perspective );
transitionKit.material.SetFloat( "_Depth", depth );
transitionKit.material.SetInt( "_Direction", runEffectInReverse ? 1 : 0 );

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
Application.LoadLevelAsync( nextScene );
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

yield return transitionKit.StartCoroutine( transitionKit.tickProgressPropertyInMaterial( duration ) );
}
// set some material properties
transitionKit.material.SetFloat( "_Perspective", perspective );
transitionKit.material.SetFloat( "_Depth", depth );
transitionKit.material.SetInt( "_Direction", runEffectInReverse ? 1 : 0 );

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
{
Application.LoadLevelAsync( nextScene );
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}

#endregion
yield return transitionKit.StartCoroutine( transitionKit.tickProgressPropertyInMaterial( duration ) );
}

#endregion

}
}
77 changes: 40 additions & 37 deletions Assets/Plugins/TransitionKit/transitions/FishEyeTransition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,57 @@
using Prime31.TransitionKit;


public class FishEyeTransition : TransitionKitDelegate
namespace Prime31.TransitionKit
{
public float duration = 0.5f;
public int nextScene = -1;
public float size = 0.2f;
public float zoom = 100.0f;
public float colorSeparation = 0.2f;
public class FishEyeTransition : TransitionKitDelegate
{
public float duration = 0.5f;
public int nextScene = -1;
public float size = 0.2f;
public float zoom = 100.0f;
public float colorSeparation = 0.2f;


#region TransitionKitDelegate implementation
#region TransitionKitDelegate implementation

public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Fish Eye" );
}
public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Fish Eye" );
}


public Mesh meshForDisplay()
{
return null;
}
public Mesh meshForDisplay()
{
return null;
}


public Texture2D textureForDisplay()
{
return null;
}
public Texture2D textureForDisplay()
{
return null;
}


public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

// set some material properties
transitionKit.material.SetFloat( "_Size", size );
transitionKit.material.SetFloat( "_Zoom", zoom );
transitionKit.material.SetFloat( "_ColorSeparation", zoom );

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
Application.LoadLevelAsync( nextScene );
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

yield return transitionKit.StartCoroutine( transitionKit.tickProgressPropertyInMaterial( duration ) );
}
// set some material properties
transitionKit.material.SetFloat( "_Size", size );
transitionKit.material.SetFloat( "_Zoom", zoom );
transitionKit.material.SetFloat( "_ColorSeparation", zoom );

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
{
Application.LoadLevelAsync( nextScene );
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}

#endregion
yield return transitionKit.StartCoroutine( transitionKit.tickProgressPropertyInMaterial( duration ) );
}

}
#endregion

}
}
73 changes: 38 additions & 35 deletions Assets/Plugins/TransitionKit/transitions/RippleTransition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,55 @@
using Prime31.TransitionKit;


public class RippleTransition : TransitionKitDelegate
namespace Prime31.TransitionKit
{
public float duration = 0.5f;
public int nextScene = -1;
public float speed = 50.0f;
public float amplitude = 100.0f;
public class RippleTransition : TransitionKitDelegate
{
public float duration = 0.5f;
public int nextScene = -1;
public float speed = 50.0f;
public float amplitude = 100.0f;


#region TransitionKitDelegate implementation
#region TransitionKitDelegate implementation

public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Ripple" );
}
public Shader shaderForTransition()
{
return Shader.Find( "prime[31]/Transitions/Ripple" );
}


public Mesh meshForDisplay()
{
return null;
}
public Mesh meshForDisplay()
{
return null;
}


public Texture2D textureForDisplay()
{
return null;
}
public Texture2D textureForDisplay()
{
return null;
}


public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

// set some material properties
transitionKit.material.SetFloat( "_Speed", speed );
transitionKit.material.SetFloat( "_Amplitude", amplitude );

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
public IEnumerator onScreenObscured( TransitionKit transitionKit )
{
Application.LoadLevelAsync( nextScene );
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}
transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

yield return transitionKit.StartCoroutine( transitionKit.tickProgressPropertyInMaterial( duration ) );
}
// set some material properties
transitionKit.material.SetFloat( "_Speed", speed );
transitionKit.material.SetFloat( "_Amplitude", amplitude );

// we dont transition back to the new scene unless it is loaded
if( nextScene >= 0 )
{
Application.LoadLevelAsync( nextScene );
yield return transitionKit.StartCoroutine( transitionKit.waitForLevelToLoad( nextScene ) );
}

#endregion
yield return transitionKit.StartCoroutine( transitionKit.tickProgressPropertyInMaterial( duration ) );
}

}
#endregion

}
}
Loading

0 comments on commit a262158

Please sign in to comment.