public void Update() { if (lastFrameCount < 0) { filteredValue = realValue; } if (Time.frameCount != lastFrameCount) { var fromKnob = MidiJack.GetKnob(knobNumber); if (fromKnob != lastKnobValue) { realValue = Mathf.Lerp(minValue, maxValue, fromKnob); lastKnobValue = fromKnob; } if (sensitivity >= 1.0f) { filteredValue = realValue; } else { filteredValue = ExpEase.Out(filteredValue, realValue, sensitivity * -9.9f - 0.1f); } lastFrameCount = Time.frameCount; } }
void Update() { launchpad.Update(this); // Yaw, Pitch cameraPivot.localRotation = Quaternion.AngleAxis(knobYaw.Current, Vector3.up) * Quaternion.AngleAxis(knobPitch.Current, Vector3.right); // Turbulence foreach (var shaker in lineShakers) { shaker.position.amount = knobTurbulence.Current; } twistPivot.localPosition = Vector3.up * knobTurbulence.Current * 0.4f; // Alignment for (var i = 0; i < linePivots.Length; i++) { var x = i - linePivots.Length / 2 + 0.5f; linePivots [i].localPosition = Vector3.forward * knobAlignment.Current * x; } // Twist twistPivot.localRotation = Quaternion.AngleAxis(knobTwist.Current, Vector3.right); // Impulse animation (camera and light) Camera.main.fieldOfView = ExpEase.Out(Camera.main.fieldOfView, initialFieldOfView, -6.0f); mainLight.intensity = ExpEase.Out(mainLight.intensity, initialLightIntensity, -4.0f); // Stage switching stageParam = ExpEase.Out(stageParam, stageSwitch ? 1.0f : 0.0f, -4.0f); GetComponent <PolishableProbeMixer> ().mix = stageParam; if (stageParam > 0.001f) { globeDeformer.enabled = true; globeDeformer.deformAmount = Vector3.one * (stageParam * 0.1f); bloomFx.enabled = true; bloomFx.bloomIntensity = stageParam; } else { globeDeformer.enabled = false; bloomFx.enabled = false; } globeDeformer.transform.localScale = Vector3.one * (50.0f - stageParam * 0.5f); // Balls ballEmitter.emissionRate = ballSwitch ? 140 : 0; }