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

public class MuteToggle : MonoBehaviour {
	public UnityEngine.UI.Toggle mute;
	private bool currentVolume = true;
	// Use this for initialization
	void Start () {
		mute = GameObject.Find ("ToggleMute").GetComponent<UnityEngine.UI.Toggle>();
	}
	
	// Update is called once per frame
	void FixedUpdate () {
		if (mute.isOn == true && currentVolume == false) {
			AudioListener.volume = 0;
			//Debug.Log ("Mute On");
			currentVolume = mute.isOn;
		} else if (mute.isOn == false && currentVolume == true) {
			AudioListener.volume = 1;
			//Debug.Log ("Mute Off");
			currentVolume = mute.isOn;
		}
	}
}
