using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class music_control : MonoBehaviour {
[HideInInspector]
public bool[] _music_fx = new bool[2]{true,true};
public AudioSource _theme;
[HideInInspector]
public Sprite[] _textbuttons;
float _vol_default = 1f;
[HideInInspector]
public Button[] _bt = new Button[4];
void Awake(){
_vol_default = _theme.volume;
}
public void _music_change(){
if (_music_fx [0]) {
_music_fx [0] = false;
_bt[0].GetComponent<Image>().sprite = _textbuttons [0];
_bt[1].GetComponent<Image>().sprite = _textbuttons [0];
_theme.volume = 0f;
} else {
_music_fx [0] = true;
_theme.volume = _vol_default;
_bt[0].GetComponent<Image>().sprite = _textbuttons [1];
_bt[1].GetComponent<Image>().sprite = _textbuttons [1];
}
}
public void _fx_change(){
if (_music_fx [1]) {
_music_fx [1] = false;
_bt[2].GetComponent<Image>().sprite = _textbuttons [2];
_bt[3].GetComponent<Image>().sprite = _textbuttons [2];
} else {
_music_fx [1] = true;
_bt[2].GetComponent<Image>().sprite = _textbuttons [3];
_bt[3].GetComponent<Image>().sprite = _textbuttons [3];
}
}
public void _play (AudioSource _sound, int _typ = 0){
if (_typ == 0) {
if (_music_fx [1]) {
_sound.Play ();
}
} else {
if (_music_fx [0]) {
_sound.Play ();
}
}
}
public void _resetmusic(){
if(_music_fx [0]){
_theme.Play();
}
}
}