Last active
March 9, 2019 11:16
-
-
Save pr00thmatic/164c682f0e73fb9b1b8588d0ac762cc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
// use it like this: | |
// yield return new PauseFriendlyWaitForSeconds(1.3f); | |
public class PauseFriendlyWaitForSeconds : CustomYieldInstruction { | |
float elapsed = 0; | |
float waitingTime; | |
public override bool keepWaiting { | |
get { | |
elapsed += GameController.Instance.IsPaused? 0: Time.deltaTime; | |
return elapsed < waitingTime; | |
} | |
} | |
public PauseFriendlyWaitForSeconds (float waitingTime) { | |
elapsed = 0; | |
this.waitingTime = waitingTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment