using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class PauseMenu : MonoBehaviour
{
	public string mainMenu;

	public bool isPaused;

	public GameObject pauseMenuCanvas;

	// Update is called once per frame
	void Update()
	{
		if(isPaused)
		{
			pauseMenuCanvas.SetActive(true);
			Time.timeScale = 0f;
			//GameObject.FindGameObjectWithTag("Music").GetComponent<AudioSource>().volume = 0.1f;
		}
		else
		{
			pauseMenuCanvas.SetActive(false);
			Time.timeScale = 1f;
			//GameObject.FindGameObjectWithTag("Music").GetComponent<AudioSource>().volume = 1f;
		}

		if(Input.GetButtonDown("Fire3"))
		{
			isPaused = !isPaused;
		}
	}

	public void Resume()
	{
		isPaused = false;
	}

	public void Restart()
	{
		Application.LoadLevel(Application.loadedLevel);
	}

	public void Quit()
	{
		Application.LoadLevel(mainMenu);
	}
}
