Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MySuperAwesomeSubclassThatGetsFaded : MonoBehaviour{
- bool shouldFadeOut = true;
- }
- public class Fader : MonoBehaviour{
- void Start(){
- MySuperAwesomeSubclassThatGetsFaded superAwesomeInstance;
- FadeOut(superAwesomeInstance);
- //later...
- superAwesomeInstance.shouldFadeOut = false; //kill the fade
- }
- IEnumerator FadeObject (MySuperAwesomeSubclassThatGetsFaded subc) {
- while (SomeFadingTest) {
- // SomeFadingCode()
- if(!subc.shouldFadeOut) return; //if the flag on the object gets set to false, then stop the fade
- yield return null;
- }
- // Put object back in the pool code
- }
- }
Add Comment
Please, Sign In to add comment