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

public class AudioStateUpdate : MonoBehaviour {

	SpriteState audioSpriteState = new SpriteState();

	Image myImage;
	Button myButton;

	public Sprite audioOn;
	public Sprite audioOff;

	void Start()
	{
		myImage = GetComponent<Image>();
		myButton = GetComponent<Button>();
	}


	public void UpdateAudioButtonStatus()
	{
		if(!OptionButtons.instance.muted)
		{
			myImage.sprite = audioOn;
			audioSpriteState.highlightedSprite = audioSpriteState.pressedSprite =  audioSpriteState.disabledSprite = audioOff;
		}
		else
		{
			myImage.sprite = audioOff;
			audioSpriteState.highlightedSprite = audioSpriteState.pressedSprite = audioSpriteState.disabledSprite = audioOn;
		}

		myButton.spriteState = audioSpriteState;

	}

}
