Exemple #1
0
    public void Stop(string audioControlIDStr)
    {
        int audioControlID = int.Parse(audioControlIDStr);
        EazySoundDemoAudioControls audioControl = AudioControls[audioControlID];

        audioControl.audio.Stop();
    }
Exemple #2
0
    public void PlaySound2()
    {
        EazySoundDemoAudioControls audioControl = AudioControls[3];
        int audioID = SoundManager.PlaySound(audioControl.audioclip, audioControl.volumeSlider.value);

        AudioControls[3].audio = SoundManager.GetAudio(audioID);
    }
Exemple #3
0
    public void AudioVolumeChanged(string audioControlIDStr)
    {
        int audioControlID = int.Parse(audioControlIDStr);
        EazySoundDemoAudioControls audioControl = AudioControls[audioControlID];

        if (audioControl.audio != null)
        {
            audioControl.audio.SetVolume(audioControl.volumeSlider.value, 0);
        }
    }
    public void PlayMusic2()
    {
        EazySoundDemoAudioControls audioControl = AudioControls[1];

        if (audioControl.audio != null && audioControl.audio.paused)
        {
            audioControl.audio.Resume();
        }
        else
        {
            int audioID = SoundManager.PlayMusic(audioControl.audioclip, audioControl.volumeSlider.value, false, false);
            AudioControls[1].audio = SoundManager.GetAudio(audioID);
        }
    }
Exemple #5
0
    public void PlayMusic1()
    {
        EazySoundDemoAudioControls audioControl = AudioControls[0];

        if (audioControl.audio == null)
        {
            int audioID = EazySoundManager.PlayMusic(audioControl.audioclip, audioControl.volumeSlider.value, true, false);
            AudioControls[0].audio = EazySoundManager.GetAudio(audioID);
        }
        else if (audioControl.audio != null && audioControl.audio.Paused)
        {
            audioControl.audio.Resume();
        }
        else
        {
            audioControl.audio.Play();
        }
    }
Exemple #6
0
    private void Update()
    {
        globalUpdateSystem.OnUpdate(Time.deltaTime);

        // Update UI
        for (int i = 0; i < AudioControls.Length; i++)
        {
            EazySoundDemoAudioControls audioControl = AudioControls[i];
            if (audioControl.audio != null && audioControl.audio.IsPlaying)
            {
                if (audioControl.pauseButton != null)
                {
                    audioControl.playButton.interactable  = false;
                    audioControl.pauseButton.interactable = true;
                    audioControl.stopButton.interactable  = true;
                    audioControl.pausedStatusTxt.enabled  = false;
                }
            }
            else if (audioControl.audio != null && audioControl.audio.Paused)
            {
                if (audioControl.pauseButton != null)
                {
                    audioControl.playButton.interactable  = true;
                    audioControl.pauseButton.interactable = false;
                    audioControl.stopButton.interactable  = false;
                    audioControl.pausedStatusTxt.enabled  = true;
                }
            }
            else
            {
                if (audioControl.pauseButton != null)
                {
                    audioControl.playButton.interactable  = true;
                    audioControl.pauseButton.interactable = false;
                    audioControl.stopButton.interactable  = false;
                    audioControl.pausedStatusTxt.enabled  = false;
                }
            }
        }
    }
 // Update is called once per frame
 void Update()
 {
     // Update UI
     for (int i = 0; i < AudioControls.Length; i++)
     {
         EazySoundDemoAudioControls audioControl = AudioControls[i];
         if (audioControl.audio != null && audioControl.audio.playing)
         {
             if (audioControl.pauseButton != null)
             {
                 audioControl.playButton.interactable  = false;
                 audioControl.pauseButton.interactable = true;
                 audioControl.stopButton.interactable  = true;
                 audioControl.pausedStatusTxt.enabled  = false;
             }
         }
         else if (audioControl.audio != null && audioControl.audio.paused)
         {
             if (audioControl.pauseButton != null)
             {
                 audioControl.playButton.interactable  = true;
                 audioControl.pauseButton.interactable = false;
                 audioControl.stopButton.interactable  = false;
                 audioControl.pausedStatusTxt.enabled  = true;
             }
         }
         else
         {
             if (audioControl.pauseButton != null)
             {
                 audioControl.playButton.interactable  = true;
                 audioControl.pauseButton.interactable = false;
                 audioControl.stopButton.interactable  = false;
                 audioControl.pausedStatusTxt.enabled  = false;
             }
         }
     }
 }