How to Pause game

Hello!. In my 3d Game i have a panel which is the one you see when the game loads. I have this as the panel you use to play the game. But one question how do i make an if statement where if the game panel PanelStart is active then the TimeScale= 0 ?
here is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class Play : MonoBehaviour
{

    

    public GameObject PanelStart;

   void Paused ()
    {

    }

    public void Start()
        {
            PanelStart.SetActive(false);
            Time.timeScale = 1;
        }
    }

You have to design a game manager from the ground up.

public class GameManager : MonobBehaviour {

	pubic enum GameState {
		MainMenu,
		Running,
		Paused
		
	}
	
	public GameState gameState = GameState.MainMenu;
	
	pubic void Update () {
	
		
		if (Input.GetKeyDown(KeyCode.P)) {
			if (gameState == GameState.Paused;)
				gameState = GameState.Running;
			else 
				gameState = GameState.Paused;
		} 
		
		
		switch (gameState) {
			case (GameState.MainMenu):
				// DO things
				break;
				
			case (GameState.Running):
				// Enable all relevant objects
				break;
				
			case (GameState.Paused):
				// Disbale all relevant objext
				break;
		}
	}
}