void Start() { musicEvent = FMODUnity.RuntimeManager.CreateInstance(music); musicEvent.getParameter("Intensity", out intensity); intensity.getValue(out intensityValue); musicEvent.getParameter("Panner", out panner); intensity.getValue(out pannerValue); }
// Update is called once per frame void Update() { //speedPitch.setValue(Mathf.InverseLerp (0, Input.GetAxisRaw("Triggers"), 0.5f)); speedPitch.getValue(out speedValue); boostPitch.getValue(out boostValue); speedPitch.setValue(Mathf.SmoothDamp(speedValue, Mathf.InverseLerp(0.0f, 1.0f, Input.GetAxisRaw("Triggers")), ref speedSmooth, 1.0f)); if (boostScript.m_isBoosting == true) { boostPitch.setValue(Mathf.SmoothDamp(boostValue, 1.0f, ref boostSmooth, 1.0f)); } else { boostPitch.setValue(Mathf.SmoothDamp(boostValue, 0.0f, ref boostSmooth, 1.0f)); } hoverSound.set3DAttributes(UnityUtil.to3DAttributes(transform.position)); }
IEnumerator VaryWindParam(ParameterInstance param) { float currValue; param.getValue(out currValue); // random range is based on the current settings in FMOD float newValue = Random.Range(0, 10); float amountOfChange = Mathf.Abs(currValue - newValue); // a larger change in speed should be applied over a longer period of time float changeTime = amountOfChange * 3; float elapsedTime = 0; while (elapsedTime < changeTime) { currValue = Mathf.Lerp(currValue, newValue, (elapsedTime / changeTime)); param.setValue(currValue); elapsedTime += Time.deltaTime; yield return null; } StartCoroutine(VaryWindParam(param)); }