Example #1
0
    public void PlaySound2()
    {
        EazySoundDemoAudioControls audioControl = AudioControls[3];
        int audioID = EazySoundManager.PlaySound(audioControl.audioclip, audioControl.volumeSlider.value);

        AudioControls[3].audio = EazySoundManager.GetAudio(audioID);
    }
Example #2
0
    private void Awake()
    {
        trans       = GetComponent <Transform>();
        skillUser   = playerMovement.GetComponent <SkillUser>();
        playerStats = playerMovement.GetComponent <PlayerStats>();
        int curID = EazySoundManager.PlaySound(singleAudio, baseVolume, true, null);

        currentAudio = EazySoundManager.GetAudio(curID);
    }
 private void ClearAmbientQueue()
 {
     if (_ambientMusicId.HasValue)
     {
         Audio audio = null;
         audio = EazySoundManager.GetAudio(_ambientMusicId.Value);
         audio.Stop();
         audio = null;
     }
 }
    private void PlaySoundAudio(MAudio mAudio, bool loop)
    {
        _soundId = EazySoundManager.PrepareMusic(
            mAudio.AudioClip,
            0.2f,
            loop,
            false
            );
        Audio audio = EazySoundManager.GetAudio(_soundId.Value);

        audio.Play();
    }
    public void PlaySound(AudioTag audioTag)
    {
        if (EazySoundManager.GetAudio(dict_AudioClips[audioTag]) == null)
        {
            EazySoundManager.PlaySound(dict_AudioClips[audioTag], sound_Volume);
        }

        else if (!EazySoundManager.GetAudio(dict_AudioClips[audioTag]).IsPlaying)
        {
            EazySoundManager.PlaySound(dict_AudioClips[audioTag], sound_Volume);
        }
    }
    private Audio PlayAmbientAudio(MAudio mAudio, bool loop, bool loadMany = false)
    {
        ClearAmbientQueue();
        _ambientMusicId = EazySoundManager.PrepareMusic(
            loadMany ? mAudio.AudioClips[mAudio.GetRandomIndex()] : mAudio.AudioClip,
            0.2f,
            loop,
            false
            );
        Audio audio = EazySoundManager.GetAudio(_ambientMusicId.Value);

        audio.Play();
        return(audio);
    }
Example #7
0
 private void ClearAmbientQueue()
 {
     if (_ambientMusicId.HasValue)
     {
         Audio audio = null;
         audio = EazySoundManager.GetAudio(_ambientMusicId.Value);
         if (audio == null)
         {
             Debug.LogError("audio has a problem");
             return;
         }
         audio.Stop();
         audio = null;
     }
 }
Example #8
0
    public void PlayMusic2()
    {
        EazySoundDemoAudioControls audioControl = AudioControls[1];

        if (audioControl.audio == null)
        {
            int audioID = EazySoundManager.PlayMusic(audioControl.audioclip, audioControl.volumeSlider.value, true, false);
            AudioControls[1].audio = EazySoundManager.GetAudio(audioID);
        }
        else if (audioControl.audio != null && audioControl.audio.Paused)
        {
            audioControl.audio.Resume();
        }
        else
        {
            audioControl.audio.Play();
        }
    }
    public void PlayBackgroundMusic(string musicName, bool loop = true, float?time = null)
    {
        Audio audio;

        if (_backgroundMusicId.HasValue)
        {
            audio = EazySoundManager.GetAudio(_backgroundMusicId.Value);
            audio.Stop();
        }
        _backgroundMusicId = EazySoundManager.PrepareMusic(Sounds[musicName].AudioClip, 0.7f, loop, false);
        _backgroundMusic   = musicName;
        audio = EazySoundManager.GetAudio(_backgroundMusicId.Value);
        audio.Play();
        if (time.HasValue)
        {
            audio.AudioSource.time = time.Value;
        }
    }
 public void SetMusic()
 {
     if (IsPlaySound)
     {
         if (m_BGAudio == null)
         {
             int id = EazySoundManager.PlayMusic(BGClip);
             m_BGAudio = EazySoundManager.GetAudio(id);
         }
         EazySoundManager.GlobalSoundsVolume   = 1;
         EazySoundManager.GlobalUISoundsVolume = 1;
         m_BGAudio.Play();
     }
     else
     {
         EazySoundManager.GlobalSoundsVolume   = 0;
         EazySoundManager.GlobalUISoundsVolume = 0;
         EazySoundManager.StopAll(1);
     }
 }
    public void OnMusicVolumeChanged(float value)
    {
        music_Volume = value;

        Audio audio = EazySoundManager.GetAudio(currentMusicId);

        //if (music_Volume == 0)
        //{
        //    audio.pa
        //}
        audio.SetVolume(music_Volume, 0);

        if (audio.Paused)
        {
            audio.Resume();
        }
        else if (!audio.IsPlaying)
        {
            audio.Play();
        }
    }
Example #12
0
 public Audio GetAudio(int audioID)
 {
     return(EazySoundManager.GetAudio(audioID));
 }