public void playOneShotSound(enm_oneShotSound argsS) { string path = "Sounds/SE/"; AudioSource tmpAC = null; if (oneShotSound.ContainsKey(argsS) == false) { //作って入れる GameObject tmpGO = Instantiate(_SE_base) as GameObject; tmpAC = tmpGO.GetComponent <AudioSource>(); oneShotSound.Add(argsS, tmpAC); tmpAC.clip = Resources.Load(path + argsS.ToString()) as AudioClip; if (tmpAC.clip == null) { Debug.Log("audioClip : " + argsS.ToString() + " is not Found"); } } else { tmpAC = oneShotSound[argsS] as AudioSource; } tmpAC.Play(); }
private void setSE(string argsStr){ string tagMain = argsStr.Substring (1, (argsStr.Length-2)); //各個の消去 string[] spritStr = tagMain.Split(new string[]{":"}, System.StringSplitOptions.None); //sprit int tmpInt = int.Parse(spritStr[1]); enm_oneShotSound tmpS = enm_oneShotSound.charaMenu; switch(tmpInt){ case 0: tmpS = enm_oneShotSound.effect001; break; case 1: tmpS = enm_oneShotSound.attack03; break; case 2: tmpS = enm_oneShotSound.scream_of_a_monster_C1; break; case 3: tmpS = enm_oneShotSound.knocking_a_wooden_door; break; case 4: tmpS = enm_oneShotSound.removeCloud; break; case 5: tmpS = enm_oneShotSound.duck; break; case 6: tmpS = enm_oneShotSound.tinnitus; break; case 7: tmpS = enm_oneShotSound.horror; break; } soundManagerGetter.getManager().playOneShotSound (tmpS); }