예제 #1
0
    IEnumerator RandomOneshotPlayer(AudioSourcePRO s, Ambience.AmbienceSetting setting, Ambience ambience, bool immediate = false)
    {
        if (immediate)
        {
            //yield return new WaitForSeconds(setting.Delay());
        }
        if (!s.isPlaying)
        {
            s.Play(0);
        }

        yield return(new WaitForSeconds(setting.Delay()));

        StartCoroutine(RandomPlayer(s, setting, ambience));
    }
예제 #2
0
    IEnumerator RandomPlayer(AudioSourcePRO s, Ambience.AmbienceSetting setting, Ambience ambience, bool immediate = false)
    {
        if (immediate)
        {
            yield return(new WaitForSeconds(setting.Delay()));
        }
        if (!s.isPlaying)
        {
            s.timeSamples = Random.Range(0, s.clip.samples);
            s.Play(ambience.Fade());
        }
        yield return(new WaitForSeconds(setting.Delay()));

        s.Stop(ambience.Fade());
        yield return(new WaitForSeconds(setting.Delay()));

        StartCoroutine(RandomPlayer(s, setting, ambience));
    }
예제 #3
0
    void CheckDistanceToListener()
    {
        if (Vector3.Distance(transform.position, listener.transform.position) < radius)
        {
            inRadius = true;
            StopThisSource();

            if (!jingle.isPlaying)
            {
                if (!message.isPlaying && !solved)
                {
                    message.PlayDelayed(timeBeforeMessage, 0.5f);
                    messageStarted = true;
                }
                jingle.Play(0.1f);
                StopAllOtherLocations();
                //FOR NOW
                solved = true;
            }
            if (messageStarted)
            {
                if (!message.isPlaying)
                {
                    Invoke("WaitAfterSolved", timeAfterMessage);
                }
            }
        }
        if (Vector3.Distance(transform.position, listener.transform.position) > radius)
        {
            if (!inRadius)
            {
                return;
            }

            /*	if (jingle.isPlaying)
             *      {
             *              jingle.Stop(1.5f);
             *              StartAllOtherLocations();
             *              inRadius = false;
             *      }*/
        }
    }