Beispiel #1
0
    private void HandleEscapeInput()
    {
        //Get the selected layer's index.
        int selectedLayerIndex = GetSelectedLayerIndex();

        //Check if the UI manager controls the pause manager.
        if (controlsGamePause)
        {
            //Check if the game is paused.
            if (pause.isPaused)
            {
                //If the selected layer is not the base layer, descend one layer.
                if (selectedLayerIndex > 0)
                {
                    AudioManager.Instance.PlayUISound(submitSound, submitVolume);
                    MoveToPreviousLayer();
                    return;
                }

                //If the selected layer is the base layer, continue the game.
                else if (selectedLayerIndex == 0)
                {
                    pause.ContinueGame();
                    return;
                }
            }

            //Check if the game is not paused.
            else
            {
                //Prevent game from being paused after player died.
                if (PlayerManager.Instance.isDead && levelManager.isLoading)
                {
                    return;
                }

                //Pause the game and move to base layer.
                pause.PauseGame();
                MoveToLayer(0);
            }
        }

        //The UI manager doesn't control the pause manager.
        else
        {
            //If the selected layer is not the base layer, descend one layer.
            if (selectedLayerIndex > 0)
            {
                AudioManager.Instance.PlayUISound(submitSound, submitVolume);
                MoveToPreviousLayer();
                return;
            }
        }
    }
 private void HideExitScreen()
 {
     PauseManager.ContinueGame();
     ExitScreen.SetActive(false);
     _exitScreenIsVisible = false;
 }