// Update is called once per frame private void Start() { //Load Resource audioSourceSFX = GameObject.Find("SFX").GetComponent <AudioSource>(); audioSourceBGM = this.transform.GetComponent <AudioSource>(); audioSourceSFX.volume = PlayerPrefs.GetFloat("sfx"); audioSourceBGM.volume = PlayerPrefs.GetFloat("bgm"); resource = ScenarioResource.GetInstace(); resource.Load(); audioSourceSFX.PlayOneShot(resource.GetSFX(5)); audioSourceBGM.clip = resource.GetBGM(6); audioSourceBGM.Play(); }
// Start is called before the first frame update void Start() { //Load Resource _currCount = 0; _health = this.transform.Find("Health").GetComponent <Image>(); _audioSourceBGM = this.GetComponent <AudioSource>(); _audioSourceSFX = GameObject.Find("SFX").GetComponent <AudioSource>(); _audioSourceSFX.volume = PlayerPrefs.GetFloat("sfx"); _audioSourceBGM.volume = PlayerPrefs.GetFloat("bgm"); resource = ScenarioResource.GetInstace(); resource.Load(); audioClip = resource.GetSFX(1); _audioSourceBGM.clip = resource.GetBGM(3); _audioSourceBGM.Play(); }
private void PlayBGM() { audioClip = resource.GetBGM(_indexBGM); audioSourceBGM.clip = audioClip; audioSourceBGM.Play(); }