Guest User

Untitled

a guest
Jan 18th, 2020
130
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Escape : MonoBehaviour
  2. {
  3. public static bool gameispaused = false;
  4. public GameObject pauseMenuUI;
  5. void update()
  6. {
  7. Debug.Log("update");
  8. if (Input.GetKeyDown("l"))
  9. {
  10. Debug.Log("Escape is pressed");
  11.  
  12. if (gameispaused)
  13. {
  14. Debug.Log("Escape is pressed");
  15. resume();
  16. }
  17. else
  18. {
  19. Debug.Log("Escape is pressed");
  20. Pause();
  21. }
  22. }
  23.  
  24. }
  25.  
  26. void resume ()
  27. {
  28. pauseMenuUI.SetActive(false);
  29. Time.timeScale = 1f;
  30. gameispaused = false;
  31. }
  32. void Pause ()
  33. {
  34. pauseMenuUI.SetActive(true);
  35. Time.timeScale = 0f;
  36. gameispaused = true;
  37. }
  38. }
RAW Paste Data