void Update() { //Debug.Log(EventSystem.current.currentSelectedGameObject); if (!GameManager.InSuspendedState) { if (InputManager.GetButtonDown("Pause")) { if (_currentState.Equals(MenuState.Inactive)) { StateTransition(_currentState, MenuState.Pause); GameManager.ShouldPause = true; } else if (_currentState.Equals(MenuState.Pause)) { Pause _pause = (Pause)GetElement(typeof(Pause)); _pause.Resume(); } } } else if (GameManager.IsPaused) { if (InputManager.GetButtonDown("Pause")) { if (_currentState.Equals(MenuState.Pause)) { Pause _pause = (Pause)GetElement(typeof(Pause)); _pause.Resume(); } } } if (InputManager.GetButtonDown("Cancel") && _currentState != MenuState.Confirmation) { switch (_currentState) { case MenuState.Audio: ((Audio)GetElement(typeof(Audio))).Back(); break; /*case MenuState.Confirmation: * ConfirmationWindow _w = GameObject.Find("ConfirmationWindow").GetComponent<ConfirmationWindow>(); * _w.No(); * break;*/ case MenuState.Credits: ((Credits)GetElement(typeof(Credits))).Back(); break; case MenuState.Pause: ((Pause)GetElement(typeof(Pause))).Resume(); break; case MenuState.Settings: ((Settings)GetElement(typeof(Settings))).Back(); break; case MenuState.Video: ((Video)GetElement(typeof(Video))).Back(); break; } } }
public void Draw(SpriteBatch spriteBatch) { if (menuState.Equals(MenuState.HOME)) { this.menuHome.Draw(spriteBatch); } if (menuState.Equals(MenuState.GAME)) { this.menuGame.Draw(spriteBatch); } if (menuState.Equals(MenuState.GO)) { this.menuGO.Draw(spriteBatch); } }
public void back() { disableCanvas(); switch (CurMenuState) { case MenuState.Credits: showMainMenu(); break; case MenuState.Options: if (lastState.Equals(MenuState.Main)) { showMainMenu(); } else { showPause(); } break; case MenuState.Pause: backToGame(); break; } }
public static void StateTransition(MenuState _currState, MenuState _nextState) { if (!_currState.Equals(MenuState.NoStateOverride)) { _previousState = _currState; } _currentState = _nextState; switch (_currentState) { case MenuState.Title: ActivateElement(typeof(Title)); break; case MenuState.Settings: ActivateElement(typeof(Settings)); break; case MenuState.Audio: ActivateElement(typeof(Audio)); break; case MenuState.Video: ActivateElement(typeof(Video)); break; case MenuState.Pause: ActivateElement(typeof(Pause)); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; break; case MenuState.Credits: ActivateElement(typeof(Credits)); break; case MenuState.Win: ActivateElement(typeof(Win)); break; case MenuState.Lose: ActivateElement(typeof(Lose)); break; case MenuState.Inactive: DeactivateAll(); break; } }
public static void StateTransition(MenuState _currState, MenuState _nextState) { if(!_currState.Equals(MenuState.NoStateOverride)) _previousState = _currState; _currentState = _nextState; switch(_currentState) { case MenuState.Title: ActivateElement(typeof(Title)); break; case MenuState.Settings: ActivateElement(typeof(Settings)); break; case MenuState.Audio: ActivateElement(typeof(Audio)); break; case MenuState.Video: ActivateElement(typeof(Video)); break; case MenuState.Pause: ActivateElement(typeof(Pause)); Cursor.lockState = CursorLockMode.None; Cursor.visible = true; break; case MenuState.Credits: ActivateElement(typeof(Credits)); break; case MenuState.Win: ActivateElement(typeof(Win)); break; case MenuState.Lose: ActivateElement(typeof(Lose)); break; case MenuState.Inactive: DeactivateAll(); break; } }