Синтаксис:
Используется javascript
//Script Pause
#pragma strict
var paused : boolean = false;
var window = 0;
var myFont : Font;
var style : GUIStyle;
var toggle = false;
var soundFloat : float = 1.0;
//
function Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if(!paused)
{
Time.timeScale = 0;
paused=true;
if (audio.clip)
{
audio.Pause();
}
//Screen.showCursor = true;
}
else
{
Time.timeScale = 1;
paused=false;
if (audio.clip)
{
audio.Play();
}
}
}
}
function OnGUI()
{
if(paused==true)
{
GUI.Box (Rect (Screen.width/2 - 100,Screen.height/2 - 100,200,180), "Пауза");
if (GUI.Button(Rect(Screen.width/2 - 90,Screen.height/2 - 80,180,30),"Продолжить игру"))
{
Time.timeScale = 1;
paused=false;
if (audio.clip)
{
audio.Play();
}
//Screen.showCursor = false;
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 40,180,30), "Играть заново"))
{
Time.timeScale = 1;
paused=false;
if (audio.clip)
{
audio.Play();
}
Application.LoadLevel ("sceneLevel1");
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 0,180,30), "Главное меню"))
{
Application.LoadLevel ("sceneScreenMainMenu");
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 + 40,180,30), "Выйти из игры"))
{
Application.Quit();
}
}
}
#pragma strict
var paused : boolean = false;
var window = 0;
var myFont : Font;
var style : GUIStyle;
var toggle = false;
var soundFloat : float = 1.0;
//
function Update ()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if(!paused)
{
Time.timeScale = 0;
paused=true;
if (audio.clip)
{
audio.Pause();
}
//Screen.showCursor = true;
}
else
{
Time.timeScale = 1;
paused=false;
if (audio.clip)
{
audio.Play();
}
}
}
}
function OnGUI()
{
if(paused==true)
{
GUI.Box (Rect (Screen.width/2 - 100,Screen.height/2 - 100,200,180), "Пауза");
if (GUI.Button(Rect(Screen.width/2 - 90,Screen.height/2 - 80,180,30),"Продолжить игру"))
{
Time.timeScale = 1;
paused=false;
if (audio.clip)
{
audio.Play();
}
//Screen.showCursor = false;
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 40,180,30), "Играть заново"))
{
Time.timeScale = 1;
paused=false;
if (audio.clip)
{
audio.Play();
}
Application.LoadLevel ("sceneLevel1");
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 0,180,30), "Главное меню"))
{
Application.LoadLevel ("sceneScreenMainMenu");
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 + 40,180,30), "Выйти из игры"))
{
Application.Quit();
}
}
}