예제 #1
0
    public void PlaySfx(SfxEnum sfxEnum)
    {
        var sfxClip = sfxClipInstanceArr[(int)sfxEnum];

        if (sfxClip != null)
        {
            sfxSource.PlayOneShot(sfxClip.Clip);
        }
    }
예제 #2
0
 public static void PlaySfxAtLocation(SfxEnum sfxEnum, Vector3 location)
 {
     if (instance)
     {
         instance.PlaySfxInstance(sfxEnum, location);
     }
     else
     {
         Debug.LogError("SfxPlayer: No instance refernce");
     }
 }
예제 #3
0
 public static void PlaySfx(SfxEnum sfxEnum)
 {
     if (instance)
     {
         instance.PlaySfxInstance(sfxEnum, Vector3.zero);
     }
     else
     {
         Debug.LogError("SfxPlayer: No instance refernce");
     }
 }
예제 #4
0
    private void PlaySfxInstance(SfxEnum sfxEnum, Vector3 location)
    {
        AudioClip targetClip = null;

        sfxDictionary.TryGetValue(sfxEnum, out targetClip);

        if (targetClip)
        {
            AudioSource.PlayClipAtPoint(targetClip, location, volume);
        }
        else
        {
            Debug.LogError("SfxPlayer: Clip not found");
        }
    }