/// <summary> /// Called by unity's input system when a cancel button is pressed. /// </summary> /// <param name="context">The callback context.</param> public void OnCancel(InputAction.CallbackContext context) { if (!SceneManager.GetActiveScene().isLoaded) { return; } if (!context.performed) { return; } if (Keyboard.current.escapeKey.wasPressedThisFrame) { if (MenuManager.Current.name == "MenuPlaying") { MenuManager.GoInto("MenuPaused"); return; } if (MenuManager.Current.name == "MenuPaused") { MenuManager.GoInto("MenuPlaying"); return; } } if (MenuManager.Current.name == "MenuControls" || MenuManager.Current.name == "MenuCredits" || MenuManager.Current.name == "MenuSettings" || MenuManager.Current.name == "MenuSounds") { string lastMenuName = MenuManager.Current.name; MenuManager.GoBack(); if (MenuManager.Current.name != lastMenuName) { AudioManager.Play(ScrollAudioClip, AudioCategory.Effect, 0.55f); } } }
/// <summary> /// Sets the current menu to the "Settings" menu. /// Called when the "Settings" button is pressed. /// </summary> public void OnSettingsButtonPressed() => MenuManager.GoInto("MenuSettings");