using UnityEngine;
using System.Collections;
public class InGameMenuController : MonoBehaviour {
protected GameObject pausePanel;
void Start() {
pausePanel = GameObject.Find("Pause");
// Disable at first
// pausePanel.SetActiveRecursively(false);
NGUITools.SetActive(pausePanel, false);
}
void Update() {
if (Input.GetButtonDown("Start")) {
if (Time.timeScale != 0) {
PauseGame();
}
else {
UnpauseGame();
}
}
}
private void PauseGame() {
Time.timeScale = 0;
// Show the pause menu
//pausePanel.SetActiveRecursively(true);
NGUITools.SetActive(pausePanel, true);
GameObject button = GameObject.Find("Resume Button");
// None of these manual attempts seem to work
//UICamera.selectedObject = button;
//NGUITools.SetActive(button, true);
//button.active = true;
}
private void UnpauseGame() {
Time.timeScale = 1.0f;
//pausePanel.SetActiveRecursively(false);
NGUITools.SetActive(pausePanel, false);
}
}