private void ApplyRumble(RumbleIntensity rumbleIntensity, float forceFeedbackIntensity = 1.0f, float screenshakeIntensity = 1.0f)
        {
            // Assign last applied rumbleIntensity for debugging.
            this.lastAppliedRumbleIntensity = rumbleIntensity;

            // Modify the supplied RumbleIntensity based on whether the game is paused
            {
                /* TODO: Convert pausing force feedback to work outside of Sparklite
                 * if (TimeManager.Instance.IsPaused)
                 * {
                 *  // Zero-out the vibration if the game is paused so that it doesn't vibrate forever.
                 *  // NOTE: Not modifying screenshake so that the camera doesn't pop to Zero when pausing/unpausing.
                 *
                 *  // TODO: If we want some vibrations to play while paused (e.g. a confirmation
                 *  // vibration when changing the Setting in Game Options), then we can create a new
                 *  // 'PlayWhilePaused' field on RumbleInfo, but then we'd have to implement/change
                 *  // RumbleIntensity to operate off of real-time instead of game-time... or else that rumbleIntensity
                 *  // will still go forever when the game is paused...
                 *  rumbleIntensity.ForceFeedback = ForceFeedbackIntensities.Zero;
                 * } */
            }

            this.screenShakeResponder.ApplyScreenShake(rumbleIntensity.ScreenShake);
            this.forceFeedbackResponder.SetVibration(rumbleIntensity.ForceFeedback);

            this.lastResultantRumbleIntensity = rumbleIntensity;
        }
Example #2
0
        public RumbleIntensity CalculateIntensity(RumbleIntensity rumbleIntensity, float time)
        {
            float t     = (time % timePerCycle) / timePerCycle;
            float scale = curve.Evaluate(t);

            return(rumbleIntensity * scale);
        }
        public RumbleIntensity CalculateFalloff(RumbleIntensity rumbleIntensity, float percentFromCenter)
        {
            float scale = curve.Evaluate(percentFromCenter);

            return(rumbleIntensity * scale);
        }