Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Pause : MonoBehaviour
- {
- public UIButton next;
- public UIButton restart;
- public UIButton pause;
- public GameObject camera;
- [HideInInspector]
- public Blur blur;
- [HideInInspector]
- public GrayscaleEffect ge;
- void Start()
- {
- next.gameObject.SetActive(false);
- restart.gameObject.SetActive(false);
- blur = camera.gameObject.GetComponent<Blur>();
- ge = camera.gameObject.GetComponent<GrayscaleEffect>();
- blur.enabled = false;
- ge.enabled = false;
- }
- void Update()
- {
- if(Time.timeScale == 0)
- {
- next.gameObject.SetActive(true);
- restart.gameObject.SetActive(true);
- pause.gameObject.SetActive(false);
- blur.enabled = true;
- ge.enabled = true;
- }
- else
- {
- pause.gameObject.SetActive(true);
- next.gameObject.SetActive(false);
- restart.gameObject.SetActive(false);
- blur.enabled = false;
- ge.enabled = false;
- }
- }
- void OnPause()
- {
- Time.timeScale = 0;
- }
- void OffPause()
- {
- Time.timeScale = 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement