Ejemplo n.º 1
0
        private void Update()
        {
            switch (state)
            {
            case PauseManagerState.Pausing:
                Time.timeScale = pausedTimeScale;
                state          = PauseManagerState.Paused;
                OnPause.Invoke();
                //menuUI.SetActive(true);
                RaisePausedEvent();
                break;

            case PauseManagerState.UnPausing:
                Time.timeScale = 1.0f;
                state          = PauseManagerState.Idle;
                OnUnpause.Invoke();
                //menuUI.SetActive(false);
                RaiseUnpausedEvent();
                break;
            }

            if (pauseInput)
            {
                pauseInput.ConstantValue = false;
                pause();
            }
        }
Ejemplo n.º 2
0
 private void HandleLevelWasLoaded(Scene scene, LoadSceneMode loadSceneMode)
 {
     if (_state != PauseManagerState.Idle && loadSceneMode == LoadSceneMode.Single)
     {
         Time.timeScale = 1.0f;
         _state         = PauseManagerState.Idle;
     }
 }
Ejemplo n.º 3
0
 private void OnLevelWasLoaded(int levelIndex)
 {
     if (_state != PauseManagerState.Idle)
     {
         Time.timeScale = 1.0f;
         _state         = PauseManagerState.Idle;
     }
 }
Ejemplo n.º 4
0
 public void UnPause()
 {
     //	The game will be unpaused at the start of the next update cycle.
     if (state == PauseManagerState.Paused)
     {
         state = PauseManagerState.UnPausing;
     }
 }
Ejemplo n.º 5
0
		private void Awake()
		{
			if(m_instance != null)
			{
				Destroy(this);
			}
			else
			{
				m_instance = this;
				m_state = PauseManagerState.Idle;
				m_hardPause = false;
				if(m_dontDestroyOnLoad)
					DontDestroyOnLoad(gameObject);
			}
		}
Ejemplo n.º 6
0
 public void pause()
 {
     if (state == PauseManagerState.Idle)
     {
         state     = PauseManagerState.Pausing;
         hardPause = true;
     }
     else if (state == PauseManagerState.Paused)
     {
         if (hardPause)
         {
             state     = PauseManagerState.UnPausing;
             hardPause = false;
         }
     }
 }
Ejemplo n.º 7
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(this);
     }
     else
     {
         _instance  = this;
         _state     = PauseManagerState.Idle;
         _hardPause = false;
         if (_dontDestroyOnLoad)
         {
             DontDestroyOnLoad(gameObject);
         }
     }
 }
Ejemplo n.º 8
0
        private void Awake()
        {
            if (_instance != null)
            {
                Destroy(this);
            }
            else
            {
                _instance  = this;
                _state     = PauseManagerState.Idle;
                _hardPause = false;
                SceneManager.sceneLoaded += HandleLevelWasLoaded;

                if (_dontDestroyOnLoad)
                {
                    DontDestroyOnLoad(gameObject);
                }
            }
        }
Ejemplo n.º 9
0
        private void Update()
        {
            switch (_state)
            {
            case PauseManagerState.Pausing:
                Time.timeScale = 0.0f;
                _state         = PauseManagerState.Paused;
                RaisePausedEvent();
                break;

            case PauseManagerState.UnPausing:
                Time.timeScale = 1.0f;
                _state         = PauseManagerState.Idle;
                RaiseUnpausedEvent();
                break;

            default:
                break;
            }

            if (InputManager.GetButtonDown("Pause"))
            {
                if (_state == PauseManagerState.Idle)
                {
                    _state     = PauseManagerState.Pausing;
                    _hardPause = true;
                }
                else if (_state == PauseManagerState.Paused)
                {
                    if (_hardPause)
                    {
                        _state     = PauseManagerState.UnPausing;
                        _hardPause = false;
                    }
                }
            }
        }
Ejemplo n.º 10
0
 private void Awake()
 {
     state     = PauseManagerState.Idle;
     hardPause = false;
     SceneManager.sceneLoaded += HandleLevelWasLoaded;
 }
Ejemplo n.º 11
0
		private void Update()
		{
			switch(m_state)
			{
			case PauseManagerState.Pausing:
				Time.timeScale = 0.0f;
				m_state = PauseManagerState.Paused;
				RaisePausedEvent();
				break;
			case PauseManagerState.UnPausing:
				Time.timeScale = 1.0f;
				m_state = PauseManagerState.Idle;
				RaiseUnpausedEvent();
				break;
			default:
				break;
			}
			
			if(InputManager.GetButtonDown("Pause"))
			{
				if(m_state == PauseManagerState.Idle)
				{
					m_state = PauseManagerState.Pausing;
					m_hardPause = true;
				}
				else if(m_state == PauseManagerState.Paused)
				{
					if(m_hardPause)
					{
						m_state = PauseManagerState.UnPausing;
						m_hardPause = false;
					}
				}
			}
		}
Ejemplo n.º 12
0
		private void OnLevelWasLoaded(int levelIndex)
		{
			if(m_state != PauseManagerState.Idle)
			{
				Time.timeScale = 1.0f;
				m_state = PauseManagerState.Idle;
			}
		}