コード例 #1
0
    public static void PlayClip(SFXClipName name)
    {
        if (__instance__ == null)
        {
            __instance__ = FindObjectOfType <SFXController>();
        }

        if (SFXController.__instance__)
        {
            __instance__.PlaySFX(name);
        }
    }
コード例 #2
0
 public void PlaySFX(SFXClipName name)
 {
     if (clips == null)
     {
         return;
     }
     for (int i = 0; i < clips.Length; i++)
     {
         if (clips[i] != null && clips[i].name == name)
         {
             PlayClip(clips[i].clips);
             return;
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Plays a single shot of the SFX at a specific volume.
 /// </summary>
 /// <param name="clipName"> The sfxclipname that has the audio to be played.</param>
 public void PlaySFX(SFXClipName clipName, float volumeScale)
 {
     _sfxAudioSource.PlayOneShot(_audioClipManager.GetSFXClip(clipName), volumeScale);
 }
コード例 #4
0
 /// <summary>
 /// Retrieves the audio clip associated with a sfx clip name enum.
 /// </summary>
 /// <param name="clipName">The sfx clip enumeration name</param>
 /// <returns>The audio clip associated</returns>
 public AudioClip GetSFXClip(SFXClipName clipName)
 {
     return(_sfxClips[clipName]);
 }