Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        public void PlaySystemSound(SystemSoundEnum systemSoundEnum)
        {
            var sound = GetSystemSound(systemSoundEnum);

            if (sound != null)
            {
                sound.Play();
            }
        }
Ejemplo n.º 3
0
    /// <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);                         //流す
    }