Advertisement
Guest User

Untitled

a guest
Aug 1st, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using AC;
  4.  
  5. public class PauseFocus : MonoBehaviour
  6. {
  7.  
  8. private bool isPaused;
  9.  
  10.  
  11. private void OnApplicationFocus(bool hasFocus)
  12. {
  13. if (KickStarter.stateHandler.gameState == GameState.Paused)
  14. {
  15. return;
  16. }
  17.  
  18. IsPaused = !hasFocus;
  19. }
  20.  
  21.  
  22. private void OnApplicationPause(bool pauseStatus)
  23. {
  24. if (KickStarter.stateHandler.gameState == GameState.Paused)
  25. {
  26. return;
  27. }
  28.  
  29. IsPaused = pauseStatus;
  30. }
  31.  
  32.  
  33. private bool IsPaused
  34. {
  35. set
  36. {
  37. if (isPaused != value)
  38. {
  39. isPaused = value;
  40.  
  41. if (isPaused)
  42. {
  43. KickStarter.sceneSettings.PauseGame();
  44. AC.Menu _menu = PlayerMenus.GetMenuWithName(PlayerMenus.GetMenuWithName("OptionsP").title);
  45.  
  46. _menu.TurnOn(true);
  47. }
  48. else
  49. {
  50. KickStarter.sceneSettings.UnpauseGame(1f);
  51. }
  52. }
  53. }
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement