Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using AC;
- public class PauseFocus : MonoBehaviour
- {
- private bool isPaused;
- private void OnApplicationFocus(bool hasFocus)
- {
- if (KickStarter.stateHandler.gameState == GameState.Paused)
- {
- return;
- }
- IsPaused = !hasFocus;
- }
- private void OnApplicationPause(bool pauseStatus)
- {
- if (KickStarter.stateHandler.gameState == GameState.Paused)
- {
- return;
- }
- IsPaused = pauseStatus;
- }
- private bool IsPaused
- {
- set
- {
- if (isPaused != value)
- {
- isPaused = value;
- if (isPaused)
- {
- KickStarter.sceneSettings.PauseGame();
- AC.Menu _menu = PlayerMenus.GetMenuWithName(PlayerMenus.GetMenuWithName("OptionsP").title);
- _menu.TurnOn(true);
- }
- else
- {
- KickStarter.sceneSettings.UnpauseGame(1f);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement