/// <summary>
        /// Display the next sentence in the local queue.
        /// Called when the "Continue" / "Begin" button is pressed.
        /// </summary>
        public void DisplayNextSentence()
        {
            if (_sentences.Count == 0)
            {
                MenuManager.GoBack();
                if (_onDialogueComplete != null)
                {
                    _onDialogueComplete();
                }
                return;
            }

            _currentSentence.Value = _sentences.Dequeue();

            //AudioManager.Play(textWrite, 1f, false, UnityEngine.Random.Range(0.55f, 1.35f));
        }
        /// <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);
                }
            }
        }
Beispiel #3
0
        // This menu is only ever entered via the "MenuPlaying" menu which calls
        // "GameState.Pause()" in its "OnLeave()" method, thus no need to call it here.
        // The same applies for "GameState.Resume()".

        /// <summary>
        /// Sets the current menu to the previous menu.
        /// Called when the "Done" button is pressed.
        /// </summary>
        public void OnResumeButtonPressed() => MenuManager.GoBack();
Beispiel #4
0
 /// <summary>
 /// Sets the current menu to the previous menu.
 /// Called when the "Done" button is pressed.
 /// </summary>
 public void OnDoneButtonPressed() => MenuManager.GoBack();