duck

Unity Game Pause Manager

Feb 3rd, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma strict
  2.  
  3. private static var paused : boolean = false;
  4.  
  5. static function Pause()
  6. {
  7.     if (!paused)
  8.     {
  9.         Time.timeScale = 0;
  10.         paused = true;
  11.         Screen.lockCursor = false;
  12.     }
  13. }
  14.  
  15. static function UnPause()
  16. {
  17.     if (paused)
  18.     {
  19.         Time.timeScale = 1;
  20.         paused = false;
  21.         Screen.lockCursor = true;
  22.     }
  23. }
  24.  
  25. static function IsPaused()
  26. {
  27.     return paused;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment