Example #1
0
        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
        }
Example #2
0
 private void InvokeSmartEvent()
 {
     smartEvent?.Invoke();
 }