Now that we have the main menu finished, let's continue doing this with the pause menu:
- Go ahead and open up our Gameplay scene. Update the PauseScreenBehaviour script to have the following implementation of SetPauseMenu:
/// <summary>
/// Will turn our pause menu on or off
/// </summary>
/// <param name="isPaused"></param>
public void SetPauseMenu(bool isPaused)
{
paused = isPaused;
// If the game is paused, timeScale is 0, otherwise 1
Time.timeScale = (paused) ? 0 : 1;
if(paused)
{
SlideMenuIn(pauseMenu);
}
else
{
SlideMenuOut(pauseMenu);
}
}
Note that because PauseMenuBehaviour inherits from MainMenuBehaviour, it also can call the SlideMenuIn and SlideMenuOut functions, respectively, as long as they are marked as protected or public.
- Now if we run the game, nothing...