Not really a game, but it is always good to learn and try things! :) I would recommend learning to add some sounds and 3D spacial area SFX on it, would make the immersion feeling nicer. Also pause menu only works now if you keep pressing ESC, and the world is moving at the same time, so not really good. Try this out:
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
}
else
{
Pause();
}
}
}
public void Resume()
{
pauseMenuUI.enabled = false;
Time.timeScale = 1;
GameIsPaused = false;
}
public void Pause()
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
pauseMenuUI.enabled = true;
Time.timeScale = 0;
GameIsPaused = true;
}