void Awake() { sceneManagerScript = transform.GetComponent <SceneManagerScript>(); audio = transform.GetChild(0).gameObject.AddComponent <AudioSource>(); audio.loop = false; audio.playOnAwake = false; audio.volume = sceneManagerScript.GetSEVolume(); SoundBA = Resources.Load <AudioClip>("Sound\\SE\\decision29"); SoundBB = Resources.Load <AudioClip>("Sound\\SE\\cancel2"); PVplayer = ControllerCanvas.GetChild(3).GetComponent <VideoPlayer>(); }
void Start() { Config_State = SelectState.BGMSlide; BGMValue = BGMslider.GetComponent <Slider>(); SEValue = SEslider.GetComponent <Slider>(); var manage = GameObject.FindGameObjectWithTag("AllScene"); if (manage) { managerScript = manage.GetComponent <SceneManagerScript>(); var data = managerScript.GetClearData(); var count = 0; for (int i = 0; i < data.Length / 2; i++) { if (data[i, 1] == 1) { count++; } } numtext.text = count + "/7"; BGMValue.value = managerScript.GetBGMVolume(); SEValue.value = managerScript.GetSEVolume(); var val = PlayerPrefs.GetFloat("BGM"); if (BGMValue.value != val) { BGMValue.value = PlayerPrefs.GetFloat("BGM", 1); SEValue.value = PlayerPrefs.GetFloat("SE", 1); } audio = manage.GetComponent <AudioSource>(); } else { BGMValue.value = PlayerPrefs.GetFloat("BGM", 1); SEValue.value = PlayerPrefs.GetFloat("SE", 1); } IconDistance = BGMValue.transform.localPosition - SEValue.transform.localPosition; text = img.transform.GetChild(0).GetComponent <Text>(); img.sprite = spriteA; mute1 = transform.GetChild(2).GetChild(5).gameObject; mute2 = transform.GetChild(3).GetChild(5).gameObject; if (BGMValue.value == 0) { mute1.SetActive(true); } else { mute1.SetActive(false); } if (SEValue.value == 0) { mute2.SetActive(true); } else { mute2.SetActive(false); } buttonA = Resources.Load <AudioClip>("Sound\\SE\\decision29"); buttonB = Resources.Load <AudioClip>("Sound\\SE\\cancel2"); warning = Resources.Load <AudioClip>("Sound\\SE\\warning2"); audioButton = gameObject.AddComponent <AudioSource>(); }