Forum begins after the advertisement:


When the Level Up screen is displayed…

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity When the Level Up screen is displayed…

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #16025
    Helpful?
    Up
    0
    ::

    When the Level Up screen is displayed, pressing the Esc button causes the game to pause, so I modified the code. What I want is for the Paused screen to be able to activate or deactivate even when the Level Up screen is active, but despite modifying the code, the Paused screen does not activate when the Level Up screen is displayed. How can I resolve this issue? I need your help, Mr.

    GameManager.cs

    public void PauseGame()
    {
    if (currentState != GameState.Paused)
    {
    previousState = currentState;
    ChangeState(GameState.Paused);
    Time.timeScale = 0f;
    pauseScreen.SetActive(true);
    }
    }

    public void ResumeGame()
    {
    if (currentState == GameState.Paused)
    {
    if (currentState == GameState.Paused)
    {
    ChangeState(previousState);
    Time.timeScale = (currentState == GameState.LevelUp) ? 0f : 1f;
    pauseScreen.SetActive(false);
    }
    }
    }

    void CheckForPauseAndResume()
    {
    if (Input.GetKeyUp(KeyCode.Escape))
    {
    if (currentState == GameState.Paused)
    {
    ResumeGame();
    }
    else
    {
    if (currentState == GameState.LevelUp)
    {

    pauseScreen.SetActive(true);
    }
    else
    {
    PauseGame();
    }
    }
    }
    }

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: