Exemple #1
0
    public void PlaySFX(SoundClipId id, float volume = 1.0f, float pitch = 1.0f, float delay = 0)
    {
        // Get url based on key
        string url = GetSoundClip(id);


        StartCoroutine(CoroutinePlaySFX(url, volume, pitch, delay));
    }
Exemple #2
0
    public void PlaySoundWithCallback(SoundClipId clipId, AudioCallback callback)
    {
        PlayBGSoundClip(clipId);

        if (audioCallBackCoroutine != null)
        {
            StopCoroutine(audioCallBackCoroutine);
        }

        audioCallBackCoroutine = StartCoroutine(DelayedCallback(bgm.clip.length, callback));
    }
Exemple #3
0
    string GetSoundClip(SoundClipId id)
    {
        string url;

        if (clips.ContainsKey(id))
        {
            url = clips[id];
        }
        else
        {
            Debug.LogError("Sound not found id= " + id);
            url = clips[SoundClipId.ERROR];
        }

        return(url);
    }
Exemple #4
0
    //static GameObject this;
    public void PlayBGSoundClip(SoundClipId id, float volume = 1.0f, bool loop = true, float startTime = 0)
    {
        string url = GetSoundClip(id);

        PlayBG(url, volume, loop, startTime);
    }
Exemple #5
0
 public void PlaySFXIfOnScreen(SoundClipId id, GameObject go, float volume = 1.0f, float pitch = 1.0f, float delay = 0)
 {
     // Re-write?
 }