using UnityEngine;
using System.Collections;
public class pausemenu : MonoBehaviour {
public GUISkin skin;
public bool paused = false;
private bool vedimas = true;
public Transform skriptas;
private bool A0 = false;
private bool A1 = false;
private bool A2 = false;
private bool A3 = false;
private string Resursas0;
private string Resursas1;
private string Resursas2;
private string Resursas3;
//—
public string Vardas;
private int c;
public GameObject Resursai;
void Update() {
if (vedimas) {
Time.timeScale = 0;
vedimass();
}
else
Time.timeScale = 1;
//Game time is paused
if (paused) {
Time.timeScale = 0;
}
//If you press ESC one more time game will start
else {
Time.timeScale = 1;
}
//If you press ESC 2 times game continue
if(Input.GetKeyDown(KeyCode.Escape)) {
paused = !paused;
}
}
void OnGUI() {
if (paused)
PauseMenu();
}
//If paused you see few meniu buttons
void PauseMenu() {
GUILayout.BeginArea(new Rect((Screen.width * 0.5f) - 30, (Screen.height * 0.5f) - 100, 200, 200));
if (GUILayout.Button (“Testi Zaidima”)) {
paused = !paused;
}
if(GUILayout.Button (“Pradeti Is Naujo”)) {
Application.LoadLevel(“main scene”);
}
if(GUILayout.Button (“Iseiti”)) {
Application.Quit();
}
GUILayout.EndArea();
}
void vedimass() {
GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height));
Vardas = GUILayout.TextField (Vardas, 20);
Resursai.GetComponent ().resursas [0] = int.Parse(Resursas0);
Resursas0 = GUILayout.TextField (Resursas0, 20);
var stringilgis0 = Resursas0.Length;
if(stringilgis0 > 0)
A0 = true;
Vardas = GUILayout.TextField (Vardas, 20);
Resursai.GetComponent ().resursas [1] = int.Parse(Resursas1);
Resursas1 = GUILayout.TextField (Resursas1, 20);
var stringilgis1 = Resursas1.Length;
if(stringilgis1 > 0)
A1 = true;
Vardas = GUILayout.TextField (Vardas, 20);
Resursai.GetComponent ().resursas [2] = int.Parse(Resursas2);
Resursas2 = GUILayout.TextField (Resursas2, 20);
var stringilgis2 = Resursas2.Length;
if(stringilgis2 > 0)
A2 = true;
Vardas = GUILayout.TextField (Vardas, 20);
Resursai.GetComponent ().resursas [3] = int.Parse(Resursas3);
Resursas3 = GUILayout.TextField (Resursas3, 20);
var stringilgis3 = Resursas3.Length;
if(stringilgis3 > 0)
A3 = true;
if(A0 A1 A2 A3)
if(GUILayout.Button(“Continue”, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height * 0.5f)))
vedimas = false;
}
}