コード例 #1
0
    // Pause music for sfx
    private IEnumerator CombinationSFX()
    {
        yield return(null);

        Audio.Pause();
        Audio2.Stop();

        //Insert burp sfx selection here
        Audio2.PlayOneShot(SFX[21]);
        yield return(new WaitForSeconds(1f));

        CameraAnimator.SetBool("ScreenShake", true);
        Audio2.PlayOneShot(SFX[20]);
        yield return(new WaitForSeconds(2f));

        CameraAnimator.SetBool("ScreenShake", false);
        Audio.UnPause();
    }
コード例 #2
0
    // EatingSFX 0-2 drinking sfx 3-5 eating sfx
    // 1 - 10 = gurgles, 11 - 14 = sloshes, 15 - 19 = burps :)
    public void GetSFX(int SFXChance, int GurgleChance)
    {
        if (CurrentItem.isdrink == false)
        {
            Audio2.PlayOneShot(EatingSFX[Random.Range(3, 5)]);
        }
        else if (CurrentItem.isdrink == true)
        {
            Audio2.PlayOneShot(EatingSFX[Random.Range(0, 2)]);
        }
        //Audio2.PlayOneShot(EatingSFX[Random.Range(15, 19)]);

        if (feedingScript.GetFullness() > 15)
        {
            if (!Audio.isPlaying)
            {
                SFXChance    = Random.Range(1, 5);
                GurgleChance = Random.Range(1, 5);
                //Debug.Log("GurgleChance = " + GurgleChance + "BurpChance =" + SFXChance);
                if (SFXChance == 1)
                {
                    Audio2.PlayOneShot(SFX[Random.Range(15, 19)]);
                }
                if (GurgleChance == 1)
                {
                    Audio2.PlayOneShot(SFX[Random.Range(0, 10)]);
                }
            }
        }
        if (plate.GetSelectedItem().isdrink == true)
        {
            Audio2.clip = (SFX[Random.Range(11, 14)]);
            Audio2.Play();
            Audio2.loop = false;
        }
    }