public SystemSound GetSystemSound(SystemSoundEnum systemSoundEnum) { switch (systemSoundEnum) { case SystemSoundEnum.None: return(null); case SystemSoundEnum.Asterisk: return(SystemSounds.Asterisk); case SystemSoundEnum.Beep: return(SystemSounds.Beep); case SystemSoundEnum.Exclamation: return(SystemSounds.Exclamation); case SystemSoundEnum.Hand: return(SystemSounds.Hand); case SystemSoundEnum.Question: return(SystemSounds.Question); default: throw new DeveloperException("SystemSound is Undefined for 'SystemSoundEnum.{0}'.", systemSoundEnum.ToString()); } }
public void PlaySystemSound(SystemSoundEnum systemSoundEnum) { var sound = GetSystemSound(systemSoundEnum); if (sound != null) { sound.Play(); } }
/// <summary> /// System音を流す /// </summary> /// <param name="seType">System音のタイプ</param> public void PlaySystemSE(SystemSoundEnum seType) { GameObject se = Instantiate(soundBuffer, transform); buffers.Add(se); SoundBuffer buffer = se.GetComponent <SoundBuffer>(); buffer.Initialize(); //初期化 buffer.SetVolume(maxVolume); //音量を設定 buffer.SetClip(seResource[(int)seType]); //音源設定 buffer.Play(false); //流す }