Guest User

Untitled

a guest
Oct 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. public class MySuperAwesomeSubclassThatGetsFaded : MonoBehaviour{
  2.     bool shouldFadeOut = true;
  3. }
  4.  
  5. public class Fader : MonoBehaviour{
  6.     void Start(){
  7.         MySuperAwesomeSubclassThatGetsFaded superAwesomeInstance;
  8.         FadeOut(superAwesomeInstance);
  9.         //later...
  10.         superAwesomeInstance.shouldFadeOut = false; //kill the fade
  11.     }
  12.  
  13.     IEnumerator FadeObject (MySuperAwesomeSubclassThatGetsFaded subc) {
  14.         while (SomeFadingTest) {
  15.             //  SomeFadingCode()
  16.             if(!subc.shouldFadeOut) return; //if the flag on the object gets set to false, then stop the fade
  17.             yield return null;
  18.         }
  19.     // Put object back in the pool code
  20.     }
  21. }
Add Comment
Please, Sign In to add comment