Pause at end of game

So I’m almost done with my Space Invaders style game, but I need a way to pause the game when you win (or lose) for a short amount of time, so that the player has time to see the text of “you win” or “you lose” before the application closes through Application.Quit(); Is there any way to do this without setting up some sort of complex timer thing?

I assume you call Application.Quit() from a coroutine… so…

var endOfGamePause : int; //set wait time here

function QuitGame () {

yield new WaitForSeconds(endOfGamePause);
Application.Quit();

}

It can wait and show “you win” or “you lose”.

Update

Change to C#

using UnityEngine;
using System.Collections;

public class YourScriptName : MonoBehaviour
{

    public int WaitASecondsAndQuit = 3;
    public bool isGameOver = false; //<-- this is set are game over?
    public bool isYouWin = false; //<-- this is set are the player win?

    void OnGUI ()
    {
        if (isGameOver)
        {
            if (isYouWin)
                GUI.Label(new Rect(Screen.width/2,Screen.height/2,200,50),"You win");
            else
                GUI.Label(new Rect(Screen.width/2,Screen.height/2,200,50),"You lose");
        }
    }

    IEnumerator QuitGame ()
    {
        isGameOver = true; //<-- And set other script if(isWinLose){ } to pause the game object not do any thing
        yield return new WaitForSeconds(WaitASecondsAndQuit);
        Application.Quit();
    }
}