private void Game_Update() { // Check pause. if (!m_Paused) { if (!m_MatchJustUnpaused) { bool pausePressed = false; InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule != null) { for (int index = 0; index < inputModule.playersCount; ++index) { PlayerInput playerInput = inputModule.GetPlayerInput(index); if (playerInput == null) { continue; } pausePressed |= playerInput.GetButtonDown("Pause"); } for (int index = 0; index < inputModule.wifiPlayersCount; ++index) { WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(index); if (playerInput == null) { continue; } pausePressed |= playerInput.GetButtonDown("Pause"); } } if (pausePressed) { if (m_MatchController != null) { bool canPause = m_MatchController.canPause; if (canPause) { m_MatchController.Pause(); } } } } m_MatchJustUnpaused = false; } }
private void Game_Update() { if (PhotonNetwork.room == null) { if (!m_MatchAborted) { m_MatchAborted = true; if (m_MatchController != null) { m_MatchController.MatchBecomeInvalid(); } else { OnMatchBecomeInvalid(); } } return; } if (!m_Paused) { if (!m_MatchJustUnpaused) { bool pausePressed = false; InputModule inputModule = UIEventSystem.inputModuleMain; if (inputModule != null) { for (int index = 0; index < inputModule.playersCount; ++index) { PlayerInput playerInput = inputModule.GetPlayerInput(index); if (playerInput == null) { continue; } pausePressed |= playerInput.GetButtonDown("Pause"); } for (int index = 0; index < inputModule.wifiPlayersCount; ++index) { WiFiPlayerInput playerInput = inputModule.GetWifiPlayerInput(index); if (playerInput == null) { continue; } pausePressed |= playerInput.GetButtonDown("Pause"); } } if (pausePressed) { if (m_MatchController != null) { bool canPause = m_MatchController.canPause; if (canPause) { m_MatchController.Pause(); } } } } m_MatchJustUnpaused = false; } }