void Awake() { if (GameObject.FindGameObjectsWithTag("SoundManager").Length >= 2) { Destroy(gameObject); return; } curveRate = 0.0f; nowVolume = 1.0f; updateCurve = null; DontDestroyOnLoad(this.gameObject); feed_inCurve = feed_inCurveSetting; feed_outCurve = feed_outCurveSetting; //Dictionaryに追加する bgmDictionary = new Dictionary <BGM_NAME, BGMs>(); for (int i = 0; i < bgmParameter.Length; i++) { bgmDictionary [bgmParameter [i].bgmName] = bgmParameter [i]; } seDictionary = new Dictionary <SE_NAME, SEs>(); for (int i = 0; i < seParameter.Length; i++) { seDictionary [seParameter [i].seName] = seParameter [i]; } gameObject.AddComponent <AudioSource> (); myObj = gameObject; nowBgmEnum = BGM_NAME.TITLE; SetVolume(1.0f); }
//BGMを再生する public static void PlayBGM(BGM_NAME bgmEnum) { nowBgmEnum = bgmEnum; AudioSource audio = myObj.GetComponent <AudioSource>(); BGMs bgm = bgmDictionary[bgmEnum]; audio.Stop(); audio.clip = bgm.clip; audio.loop = true; audio.volume = nowVolume * bgm.volume; audio.Play(); }
public static void Fade_inPlay(BGM_NAME bgmEnum, float frame) { nowBgmEnum = bgmEnum; BGMs bgms = bgmDictionary[bgmEnum]; myObj.GetComponent <AudioSource>().clip = bgms.clip; myObj.GetComponent <AudioSource>().Play(); updateCurve = feed_inCurve; beginVolume = 0.0f; endVolume = nowVolume * bgmDictionary[nowBgmEnum].volume; myObj.GetComponent <SoundManager>().frame = frame; }
void Awake () { if (GameObject.FindGameObjectsWithTag ("SoundManager").Length >= 2) { Destroy (gameObject); return; } curveRate = 0.0f; nowVolume = 1.0f; updateCurve = null; DontDestroyOnLoad (this.gameObject); feed_inCurve = feed_inCurveSetting; feed_outCurve = feed_outCurveSetting; //Dictionaryに追加する bgmDictionary = new Dictionary<BGM_NAME, BGMs>(); for (int i = 0; i < bgmParameter.Length; i++) { bgmDictionary [bgmParameter [i].bgmName] = bgmParameter [i]; } seDictionary = new Dictionary<SE_NAME, SEs>(); for (int i = 0; i < seParameter.Length; i++) { seDictionary [seParameter [i].seName] = seParameter [i]; } gameObject.AddComponent<AudioSource> (); myObj = gameObject; nowBgmEnum = BGM_NAME.TITLE; SetVolume (1.0f); }
//BGMを再生する public static void PlayBGM(BGM_NAME bgmEnum) { nowBgmEnum = bgmEnum; AudioSource audio = myObj.GetComponent<AudioSource>(); BGMs bgm = bgmDictionary[bgmEnum]; audio.Stop(); audio.clip = bgm.clip; audio.loop = true; audio.volume = nowVolume*bgm.volume; audio.Play(); }
public static void Fade_inPlay(BGM_NAME bgmEnum,float frame) { nowBgmEnum = bgmEnum; BGMs bgms = bgmDictionary[bgmEnum]; myObj.GetComponent<AudioSource>().clip = bgms.clip; myObj.GetComponent<AudioSource>().Play(); updateCurve = feed_inCurve; beginVolume = 0.0f; endVolume = nowVolume * bgmDictionary[nowBgmEnum].volume; myObj.GetComponent<SoundManager>().frame = frame; }