Guest User

Untitled

a guest
Feb 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. // Coroutine used to fade the Cursor either in or out
  2.         public static IEnumerator Fade(float newAlpha) {
  3.             //// vars ////
  4.             float cursFadeSpeed = GameProperties.CursFadeSpeed;
  5.             //// work ////
  6.             // fade the cursor's alpha from its current value to the new correct value
  7.             if(CursAlpha < newAlpha) {
  8.                 for(float i = CursAlpha; i < newAlpha; i += Time.smoothDeltaTime * cursFadeSpeed) {
  9.                     CursAlpha = i;
  10.                     yield return null;
  11.                 }
  12.             }
  13.             else if(CursAlpha > newAlpha) {
  14.                 for(float i = CursAlpha; i > newAlpha; i -= Time.smoothDeltaTime * cursFadeSpeed) {
  15.                     CursAlpha = i;
  16.                     yield return null;
  17.                 }
  18.             }
  19.             // set the current alpha to the new alpha
  20.             Debug.Log("test");
  21.             CursAlpha = newAlpha;
  22.         }
Add Comment
Please, Sign In to add comment