コード例 #1
0
    private IEnumerator TestAllSounds()
    {
        if (BlockedAudioSource == null)
        {
            BlockedAudioSource = GetComponent <AudioSource>();

            BlockedAudioSource.maxDistance = MaxAudioDistance;
        }

        AudioClip tempClip;

        int clipNumber = 0;

        foreach (SoundEffects SoundEffect in Enum.GetValues(typeof(SoundEffects)))
        {
            Debug.Log("Attempting to load clip #" + clipNumber);
            tempClip = SoundEffectManager.GetClip(SoundEffect);
            if (tempClip != null)
            {
                Debug.Log("Playing clip #" + clipNumber);
                BlockedAudioSource.clip = tempClip;
                BlockedAudioSource.Play();
                while (BlockedAudioSource.isPlaying)
                {
                    yield return(null);
                }
            }

            clipNumber++;
            yield return(null);
        }
    }
コード例 #2
0
    public void ProcessSoundEffect(Assets.Scripts.SoundController.PlayMode Mode, SoundEffects SoundEffect)
    {
        AudioClip clip = SoundEffectManager.GetClip(SoundEffect);

        if (clip != null)
        {
            SoundControllerInstance instance = new SoundControllerInstance(Mode, clip);
            ProcessSoundEffect(instance);
        }
    }
コード例 #3
0
ファイル: Character.cs プロジェクト: nickrnky/cloneshot
        public void RpcPlayDamageTakenSound()
        {
            AudioClip clip = new AudioClip();

            clip = SoundEffectManager.GetClip(SoundEffects.Owww);

            if (Audio == null)
            {
                Audio = GetComponent <AudioSource>();
            }
            Audio.PlayOneShot(clip);
        }
コード例 #4
0
ファイル: Character.cs プロジェクト: nickrnky/cloneshot
        public void RpcPlayDeathSound()
        {
            AudioClip clip = new AudioClip();

            switch (UnityEngine.Random.Range(0, 1))
            {
            case 0:
                clip = SoundEffectManager.GetClip(SoundEffects.Ahhh);
                break;

            case 1:
                clip = SoundEffectManager.GetClip(SoundEffects.MyLeg);
                break;
            }

            if (Audio == null)
            {
                Audio = GetComponent <AudioSource>();
            }
            Audio.PlayOneShot(clip);
        }
コード例 #5
0
 public SoundControllerInstance(PlayMode mode, SoundEffects SoundEffect)
 {
     Mode = mode;
     Clip = SoundEffectManager.GetClip(SoundEffect);
 }