Exemple #1
0
 void SetRumble(IDualMotorRumble newMotor)
 {
     if (rumbleMotor != newMotor)
     {
         rumbleMotor?.ResetHaptics();
         rumbleMotor = newMotor;
         rumbleMotor?.ResetHaptics();
     }
 }
    private IEnumerator RumbleRoutine(IDualMotorRumble rumble, float lowFreq, float highFreq, float duration)
    {
        float rumbleStartTime = Time.time;

        while (rumbleStartTime + duration > Time.time)
        {
            rumble.SetMotorSpeeds(lowFreq, highFreq);
            yield return(null);
        }

        rumble.ResetHaptics();
    }