Beispiel #1
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
        }
        DontDestroyOnLoad(this.gameObject);

        source = GetComponent <AudioSource>();
    }
Beispiel #2
0
 /// <summary>
 /// Override Play function for button click SFX.
 /// </summary>
 /// <param name="name">SFX name</param>
 /// <param name="isLoop">If the sound will loop.</param>
 public void Play(AudibleNames.Button name, bool isLoop)
 {
     if (buttonSFX == null)
     {
         if (GetComponentInChildren <ButtonSFX> () != null)
         {
             this.buttonSFX = GetComponentInChildren <ButtonSFX> ();
             this.buttonSFX.GetAudioSource(name).loop = isLoop;
             this.PlayOneShot(buttonSFX.GetAudioSource(name));
         }
     }
     else
     {
         this.buttonSFX.GetAudioSource(name).loop = isLoop;
         this.PlayOneShot(buttonSFX.GetAudioSource(name));
     }
 }
Beispiel #3
0
 public void PlayButtonSFX(ButtonSFX buttonSFX)
 {
     _ui.clip  = _buttonSFX[(int)buttonSFX];
     _ui.pitch = Random.Range(.95f, 1.05f);
     _ui.Play();
 }
Beispiel #4
0
 public void PlayClip(ButtonSFX clip, bool loop = false, bool randomTime = false)
 {
     PlayClip((int)clip, loop, randomTime);
 }