private void Update() { lowPassValue = Vector3.Lerp(lowPassValue, acceleration.value, lowPassFilterFactor); Vector3 deltaAcceleration = acceleration.value - lowPassValue; if (deltaAcceleration.sqrMagnitude >= shakeDetectionThreshold) { onShakeEvent?.Invoke(); } #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.Return)) { onShakeEvent?.Invoke(); } #endif }
private void InvokeSmartEvent() { smartEvent?.Invoke(); }