Exemple #1
0
 /// <summary>
 /// Add a vibration to the player input controller
 /// </summary>
 /// <param name="targetMotor">The target motor</param>
 /// <param name="frequency">The motor frequency.</param>
 /// <param name="duration">The duration of the vibration</param>
 /// <param name="modifier">Frequency modifier delegate</param>
 public void AddVibration(Vibration.Motor targetMotor, float frequency, float duration, Func<Vibration, float> modifier)
 {
     var vibration = new Vibration(targetMotor, frequency, duration, modifier);
     _activeVibrations.Add(vibration);
 }
Exemple #2
0
 /// <summary>
 /// Add a vibration to the player input controller
 /// </summary>
 /// <param name="targetMotor">The target motor</param>
 /// <param name="frequency">The motor frequency.</param>
 /// <param name="duration">The duration of the vibration</param>
 public void AddVibration(Vibration.Motor targetMotor, float frequency, float duration)
 {
     var vibration = new Vibration(targetMotor, frequency, duration);
     _activeVibrations.Add(vibration);
 }
Exemple #3
0
 /// <summary>
 /// Delegate to apply a linear ramp to the vibration frequency
 /// </summary>
 /// <param name="vibration">The vibration.</param>
 /// <returns>Calculated frequency</returns>
 public static float LinearRamp(Vibration vibration)
 {
     return MathHelper.Lerp(0, vibration.Frequency, 1 - (vibration.TimeRemaining/vibration.Duration));
 }
Exemple #4
0
 /// <summary>
 /// Add a vibration to the player input controller
 /// </summary>
 /// <param name="vibration">The vibration</param>
 public void AddVibration(Vibration vibration)
 {
     _activeVibrations.Add(vibration);
 }
Exemple #5
0
 /// <summary>
 /// Delegate to apply a linear falloff to the vibration frequency
 /// </summary>
 /// <param name="vibration">The vibration.</param>
 /// <returns>Calculated frequency</returns>
 public static float LinearFalloff(Vibration vibration)
 {
     return MathHelper.Lerp(vibration.Frequency, 0, 1 - (vibration.TimeRemaining/vibration.Duration));
 }