예제 #1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     Debug.Log(collision.gameObject.name);
     if (collision.gameObject.name == "Platform (8)")
     {
         this.gameObject.GetComponent <Rigidbody2D>().AddForce(new Vector2(0.0f, 20.0f), ForceMode2D.Impulse);
         HapticFeedback.DoHaptic(HapticFeedback.NotificationType.Success);
     }
     else
     {
         HapticFeedback.DoHaptic(HapticFeedback.HapticForce.Medium);
     }
 }
예제 #2
0
        public static void Vibrate(bool ignoreVibrationCooldown)
        {
            if (!VibrationEnabled())
            {
                return;
            }

            if (ignoreVibrationCooldown || Time.unscaledTime - lastVibration > timeBetweenVibrations)
            {
                lastVibration = Time.unscaledTime;
                Debug.Log("Device generation : " + ((int)Device.generation));
                if ((int)Device.generation > 30)
                {
                    HapticFeedback.DoHaptic(HapticFeedback.HapticForce.Medium);
                }
                else
                {
                    Handheld.Vibrate();
                }
            }
        }