Пример #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");
        }
    }