/// <summary> /// plays 'sound' on the auto-created, second audio source /// </summary> void DoPlaySound(AudioClip sound) { if (sound == null) { return; } Audio2.pitch = vp_TimeUtility.AdjustedTimeScale; Audio2.clip = sound; Audio2.Stop(); Audio2.Play(); }
// 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; } }
public void setBossMusic() { Audio1.Stop(); Audio2.Play(); }