Exemple #1
0
        /// <summary>
        /// When getting a flash event, we turn our image on
        /// </summary>
        public virtual void OnMMFlashEvent(Color flashColor, float duration, float alpha, int flashID, int channel, TimescaleModes timescaleMode, bool stop = false)
        {
            if (flashID != FlashID)
            {
                return;
            }

            if (stop)
            {
                _flashing = false;
                return;
            }

            if ((channel != Channel) && (channel != -1) && (Channel != -1))
            {
                return;
            }

            if (!_flashing)
            {
                _flashing              = true;
                _direction             = 1;
                _canvasGroup.alpha     = 0;
                _targetAlpha           = alpha;
                _delta                 = 0f;
                _image.color           = flashColor;
                _duration              = duration;
                _timescaleMode         = timescaleMode;
                _flashStartedTimestamp = GetTime();
            }
        }
Exemple #2
0
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="intensity"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeIntensity"></param>
        /// <param name="feedbacksIntensity"></param>
        /// <param name="channel"></param>
        public virtual void OnDepthOfFieldShakeEvent(AnimationCurve focusDistance, float duration, float remapFocusDistanceMin, float remapFocusDistanceMax,
                                                     AnimationCurve aperture, float remapApertureMin, float remapApertureMax,
                                                     AnimationCurve focalLength, float remapFocalLengthMin, float remapFocalLengthMax,
                                                     bool relativeValues      = false,
                                                     float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake               = true, bool resetTargetValuesAfterShake = true,
                                                     bool forwardDirection    = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration  = ShakeDuration;
                _originalRelativeValues = RelativeValues;

                _originalShakeFocusDistance     = ShakeFocusDistance;
                _originalRemapFocusDistanceZero = RemapFocusDistanceZero;
                _originalRemapFocusDistanceOne  = RemapFocusDistanceOne;

                _originalShakeAperture     = ShakeAperture;
                _originalRemapApertureZero = RemapApertureZero;
                _originalRemapApertureOne  = RemapApertureOne;

                _originalShakeFocalLength     = ShakeFocalLength;
                _originalRemapFocalLengthZero = RemapFocalLengthZero;
                _originalRemapFocalLengthOne  = RemapFocalLengthOne;
            }

            TimescaleMode = timescaleMode;

            ShakeDuration  = duration;
            RelativeValues = relativeValues;

            ShakeFocusDistance     = focusDistance;
            RemapFocusDistanceZero = remapFocusDistanceMin;
            RemapFocusDistanceOne  = remapFocusDistanceMax;

            ShakeAperture     = aperture;
            RemapApertureZero = remapApertureMin;
            RemapApertureOne  = remapApertureMax;

            ShakeFocalLength     = focalLength;
            RemapFocalLengthZero = remapFocalLengthMin;
            RemapFocalLengthOne  = remapFocalLengthMax;

            ForwardDirection = forwardDirection;

            Play();
        }
Exemple #3
0
        /// <summary>
        /// A method that triggers the zoom, ideally only to be called via an event, but public for convenience
        /// </summary>
        /// <param name="mode"></param>
        /// <param name="newFieldOfView"></param>
        /// <param name="transitionDuration"></param>
        /// <param name="duration"></param>
        public virtual void Zoom(MMCameraZoomModes mode, float newFieldOfView, float transitionDuration, float duration, bool useUnscaledTime)
        {
            if (_zooming)
            {
                return;
            }

            _zooming = true;
            _delta   = 0f;
            _mode    = mode;

            TimescaleMode       = useUnscaledTime ? TimescaleModes.Unscaled : TimescaleModes.Scaled;
            _startFieldOfView   = _camera.fieldOfView;
            _transitionDuration = transitionDuration;
            _duration           = duration;
            _transitionDuration = transitionDuration;
            _direction          = 1;
            _destinationReached = false;

            switch (mode)
            {
            case MMCameraZoomModes.For:
                _targetFieldOfView = newFieldOfView;
                break;

            case MMCameraZoomModes.Set:
                _targetFieldOfView = newFieldOfView;
                break;

            case MMCameraZoomModes.Reset:
                _targetFieldOfView = _initialFieldOfView;
                break;
            }
        }
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="intensity"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeIntensity"></param>
        /// <param name="attenuation"></param>
        /// <param name="channel"></param>
        public virtual void OnMMLensDistortionShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax, bool relativeIntensity = false,
                                                         float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration      = ShakeDuration;
                _originalShakeIntensity     = ShakeIntensity;
                _originalRemapIntensityZero = RemapIntensityZero;
                _originalRemapIntensityOne  = RemapIntensityOne;
                _originalRelativeIntensity  = RelativeIntensity;
            }

            TimescaleMode      = timescaleMode;
            ShakeDuration      = duration;
            ShakeIntensity     = intensity;
            RemapIntensityZero = remapMin * attenuation;
            RemapIntensityOne  = remapMax * attenuation;
            RelativeIntensity  = relativeIntensity;
            ForwardDirection   = forwardDirection;

            Play();
        }
Exemple #5
0
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="distortionCurve"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeDistortion"></param>
        /// <param name="feedbacksIntensity"></param>
        /// <param name="channel"></param>
        public virtual void OnMMAudioFilterDistortionShakeEvent(AnimationCurve distortionCurve, float duration, float remapMin, float remapMax, bool relativeDistortion = false,
                                                                float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration       = ShakeDuration;
                _originalShakeDistortion     = ShakeDistortion;
                _originalRemapDistortionZero = RemapDistortionZero;
                _originalRemapDistortionOne  = RemapDistortionOne;
                _originalRelativeDistortion  = RelativeDistortion;
            }

            TimescaleMode       = timescaleMode;
            ShakeDuration       = duration;
            ShakeDistortion     = distortionCurve;
            RemapDistortionZero = remapMin * feedbacksIntensity;
            RemapDistortionOne  = remapMax * feedbacksIntensity;
            RelativeDistortion  = relativeDistortion;
            ForwardDirection    = forwardDirection;

            Play();
        }
Exemple #6
0
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="intensity"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeIntensity"></param>
        /// <param name="feedbacksIntensity"></param>
        /// <param name="channel"></param>
        public virtual void OnMMColorGradingShakeEvent(AnimationCurve shakePostExposure, float remapPostExposureZero, float remapPostExposureOne,
                                                       AnimationCurve shakeHueShift, float remapHueShiftZero, float remapHueShiftOne,
                                                       AnimationCurve shakeSaturation, float remapSaturationZero, float remapSaturationOne,
                                                       AnimationCurve shakeContrast, float remapContrastZero, float remapContrastOne,
                                                       float duration, bool relativeValues = false,
                                                       float feedbacksIntensity            = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
                                                       bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration         = ShakeDuration;
                _originalRelativeValues        = RelativeValues;
                _originalShakePostExposure     = ShakePostExposure;
                _originalRemapPostExposureZero = RemapPostExposureZero;
                _originalRemapPostExposureOne  = RemapPostExposureOne;
                _originalShakeHueShift         = ShakeHueShift;
                _originalRemapHueShiftZero     = RemapHueShiftZero;
                _originalRemapHueShiftOne      = RemapHueShiftOne;
                _originalShakeSaturation       = ShakeSaturation;
                _originalRemapSaturationZero   = RemapSaturationZero;
                _originalRemapSaturationOne    = RemapSaturationOne;
                _originalShakeContrast         = ShakeContrast;
                _originalRemapContrastZero     = RemapContrastZero;
                _originalRemapContrastOne      = RemapContrastOne;
            }

            TimescaleMode         = timescaleMode;
            ShakeDuration         = duration;
            RelativeValues        = relativeValues;
            ShakePostExposure     = shakePostExposure;
            RemapPostExposureZero = remapPostExposureZero;
            RemapPostExposureOne  = remapPostExposureOne;
            ShakeHueShift         = shakeHueShift;
            RemapHueShiftZero     = remapHueShiftZero;
            RemapHueShiftOne      = remapHueShiftOne;
            ShakeSaturation       = shakeSaturation;
            RemapSaturationZero   = remapSaturationZero;
            RemapSaturationOne    = remapSaturationOne;
            ShakeContrast         = shakeContrast;
            RemapContrastZero     = remapContrastZero;
            RemapContrastOne      = remapContrastOne;
            ForwardDirection      = forwardDirection;

            Play();
        }
 static public void Trigger(AnimationCurve intensity, float duration, float remapMin, float remapMax,
                            AnimationCurve threshold, float remapThresholdMin, float remapThresholdMax, bool relativeIntensity = false,
                            float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true,
                            bool resetTargetValuesAfterShake = true, bool forwardDirection      = true,
                            TimescaleModes timescaleMode     = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(intensity, duration, remapMin, remapMax, threshold, remapThresholdMin, remapThresholdMax, relativeIntensity,
                     attenuation, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }
Exemple #8
0
 static public void Trigger(AnimationCurve focusDistance, float duration, float remapFocusDistanceMin, float remapFocusDistanceMax,
                            AnimationCurve aperture, float remapApertureMin, float remapApertureMax,
                            AnimationCurve focalLength, float remapFocalLengthMin, float remapFocalLengthMax,
                            bool relativeValues      = false,
                            float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake               = true, bool resetTargetValuesAfterShake = true,
                            bool forwardDirection    = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(focusDistance, duration, remapFocusDistanceMin, remapFocusDistanceMax,
                     aperture, remapApertureMin, remapApertureMax,
                     focalLength, remapFocalLengthMin, remapFocalLengthMax, relativeValues,
                     feedbacksIntensity, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }
Exemple #9
0
        /// <summary>
        /// This coroutine will shake the
        /// </summary>
        /// <returns>The camera co.</returns>
        /// <param name="duration">Duration.</param>
        /// <param name="amplitude">Amplitude.</param>
        /// <param name="frequency">Frequency.</param>
        protected virtual IEnumerator ShakeCameraCo(float duration, float amplitude, float frequency, bool infinite, bool useUnscaledTime)
        {
            _targetAmplitude = amplitude;
            _targetFrequency = frequency;
            _timescaleMode   = useUnscaledTime ? TimescaleModes.Unscaled : TimescaleModes.Scaled;
            if (!infinite)
            {
                yield return(new WaitForSeconds(duration));

                CameraReset();
            }
        }
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="intensity"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeIntensity"></param>
        /// <param name="attenuation"></param>
        /// <param name="channel"></param>
        public virtual void OnMMChannelMixerShakeEvent(AnimationCurve shakeRed, float remapRedZero, float remapRedOne,
                                                       AnimationCurve shakeGreen, float remapGreenZero, float remapGreenOne,
                                                       AnimationCurve shakeBlue, float remapBlueZero, float remapBlueOne,
                                                       float duration, bool relativeValues = false,
                                                       float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration  = ShakeDuration;
                _originalRelativeValues = RelativeValues;
                _originalShakeRed       = ShakeRed;
                _originalRemapRedZero   = RemapRedZero;
                _originalRemapRedOne    = RemapRedOne;
                _originalShakeGreen     = ShakeGreen;
                _originalRemapGreenZero = RemapGreenZero;
                _originalRemapGreenOne  = RemapGreenOne;
                _originalShakeBlue      = ShakeBlue;
                _originalRemapBlueZero  = RemapBlueZero;
                _originalRemapBlueOne   = RemapBlueOne;
            }

            TimescaleMode    = timescaleMode;
            ShakeDuration    = duration;
            RelativeValues   = relativeValues;
            ShakeRed         = shakeRed;
            RemapRedZero     = remapRedZero;
            RemapRedOne      = remapRedOne;
            ShakeGreen       = shakeGreen;
            RemapGreenZero   = remapGreenZero;
            RemapGreenOne    = remapGreenOne;
            ShakeBlue        = shakeBlue;
            RemapBlueZero    = remapBlueZero;
            RemapBlueOne     = remapBlueOne;
            ForwardDirection = forwardDirection;

            Play();
        }
Exemple #11
0
 static public void Trigger(AnimationCurve shakePostExposure, float remapPostExposureZero, float remapPostExposureOne,
                            AnimationCurve shakeHueShift, float remapHueShiftZero, float remapHueShiftOne,
                            AnimationCurve shakeSaturation, float remapSaturationZero, float remapSaturationOne,
                            AnimationCurve shakeContrast, float remapContrastZero, float remapContrastOne,
                            float duration, bool relativeValues = false,
                            float feedbacksIntensity            = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true,
                            bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(shakePostExposure, remapPostExposureZero, remapPostExposureOne,
                     shakeHueShift, remapHueShiftZero, remapHueShiftOne,
                     shakeSaturation, remapSaturationZero, remapSaturationOne,
                     shakeContrast, remapContrastZero, remapContrastOne,
                     duration, relativeValues, feedbacksIntensity, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }
 /// <summary>
 /// When we get an event we change our priorities if needed
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="forceMaxPriority"></param>
 /// <param name="newPriority"></param>
 /// <param name="forceTransition"></param>
 /// <param name="blendDefinition"></param>
 /// <param name="resetValuesAfterTransition"></param>
 public virtual void OnMMCinemachinePriorityEvent(int channel, bool forceMaxPriority, int newPriority, bool forceTransition, CinemachineBlendDefinition blendDefinition, bool resetValuesAfterTransition, TimescaleModes timescaleMode)
 {
     TimescaleMode = timescaleMode;
     if (channel == Channel)
     {
         _camera.Priority = newPriority;
     }
     else
     {
         if (forceMaxPriority)
         {
             _camera.Priority = 0;
         }
     }
 }
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="distortionCurve"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeDistortion"></param>
        /// <param name="feedbacksIntensity"></param>
        /// <param name="channel"></param>
        public virtual void OnMMCameraClippingPlanesShakeEvent(AnimationCurve animNearCurve, float duration, float remapNearMin, float remapNearMax, AnimationCurve animFarCurve, float remapFarMin, float remapFarMax, bool relativeValues = false,
                                                               float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            if (!Interruptible && Shaking)
            {
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration          = ShakeDuration;
                _originalShakeNear              = ShakeNear;
                _originalShakeFar               = ShakeFar;
                _originalRemapNearZero          = RemapNearZero;
                _originalRemapNearOne           = RemapNearOne;
                _originalRemapFarZero           = RemapFarZero;
                _originalRemapFarOne            = RemapFarOne;
                _originalRelativeClippingPlanes = RelativeClippingPlanes;
            }

            TimescaleMode          = timescaleMode;
            ShakeDuration          = duration;
            ShakeNear              = animNearCurve;
            RemapNearZero          = remapNearMin * feedbacksIntensity;
            RemapNearOne           = remapNearMax * feedbacksIntensity;
            ShakeFar               = animFarCurve;
            RemapFarZero           = remapFarMin * feedbacksIntensity;
            RemapFarOne            = remapFarMax * feedbacksIntensity;
            RelativeClippingPlanes = relativeValues;
            ForwardDirection       = forwardDirection;

            Play();
        }
 /// <summary>
 /// When getting an event we change our default transition if needed
 /// </summary>
 /// <param name="channel"></param>
 /// <param name="forceMaxPriority"></param>
 /// <param name="newPriority"></param>
 /// <param name="forceTransition"></param>
 /// <param name="blendDefinition"></param>
 /// <param name="resetValuesAfterTransition"></param>
 public virtual void OnMMCinemachinePriorityEvent(int channel, bool forceMaxPriority, int newPriority, bool forceTransition, CinemachineBlendDefinition blendDefinition, bool resetValuesAfterTransition, TimescaleModes timescaleMode)
 {
     if (forceTransition)
     {
         if (_coroutine != null)
         {
             StopCoroutine(_coroutine);
         }
         else
         {
             _initialDefinition = _brain.m_DefaultBlend;
         }
         _brain.m_DefaultBlend = blendDefinition;
         TimescaleMode         = timescaleMode;
         _coroutine            = StartCoroutine(ResetBlendDefinition(blendDefinition.m_Time));
     }
 }
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="intensity"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeIntensity"></param>
        /// <param name="attenuation"></param>
        /// <param name="channel"></param>
        public virtual void OnBloomShakeEvent(AnimationCurve intensity, float duration, float remapMin, float remapMax,
                                              AnimationCurve threshold, float remapThresholdMin, float remapThresholdMax, bool relativeIntensity = false,
                                              float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration      = ShakeDuration;
                _originalShakeIntensity     = ShakeIntensity;
                _originalRemapIntensityZero = RemapIntensityZero;
                _originalRemapIntensityOne  = RemapIntensityOne;
                _originalRelativeIntensity  = RelativeValues;
                _originalShakeThreshold     = ShakeThreshold;
                _originalRemapThresholdZero = RemapThresholdZero;
                _originalRemapThresholdOne  = RemapThresholdOne;
            }

            TimescaleMode      = timescaleMode;
            ShakeDuration      = duration;
            ShakeIntensity     = intensity;
            RemapIntensityZero = remapMin * attenuation;
            RemapIntensityOne  = remapMax * attenuation;
            RelativeValues     = relativeIntensity;
            ShakeThreshold     = threshold;
            RemapThresholdZero = remapThresholdMin;
            RemapThresholdOne  = remapThresholdMax;
            ForwardDirection   = forwardDirection;

            Play();
        }
Exemple #16
0
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="temperature"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeValues"></param>
        /// <param name="attenuation"></param>
        /// <param name="channel"></param>
        public virtual void OnWhiteBalanceShakeEvent(AnimationCurve temperature, float duration, float remapTemperatureMin, float remapTemperatureMax,
                                                     AnimationCurve tint, float remapTintMin, float remapTintMax, bool relativeValues = false,
                                                     float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration        = ShakeDuration;
                _originalShakeTemperature     = ShakeTemperature;
                _originalRemapTemperatureZero = RemapTemperatureZero;
                _originalRemapTemperatureOne  = RemapTemperatureOne;
                _originalRelativeValues       = RelativeValues;
                _originalShakeTint            = ShakeTint;
                _originalRemapTintZero        = RemapTintZero;
                _originalRemapTintOne         = RemapTintOne;
            }

            TimescaleMode        = timescaleMode;
            ShakeDuration        = duration;
            ShakeTemperature     = temperature;
            RemapTemperatureZero = remapTemperatureMin * attenuation;
            RemapTemperatureOne  = remapTemperatureMax * attenuation;
            RelativeValues       = relativeValues;
            ShakeTint            = tint;
            RemapTintZero        = remapTintMin;
            RemapTintOne         = remapTintMax;
            ForwardDirection     = forwardDirection;

            Play();
        }
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="distortionCurve"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeDistortion"></param>
        /// <param name="feedbacksIntensity"></param>
        /// <param name="channel"></param>
        public virtual void OnMMCameraFieldOfViewShakeEvent(AnimationCurve distortionCurve, float duration, float remapMin, float remapMax, bool relativeDistortion = false,
                                                            float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            if (!Interruptible && Shaking)
            {
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration        = ShakeDuration;
                _originalShakeFieldOfView     = ShakeFieldOfView;
                _originalRemapFieldOfViewZero = RemapFieldOfViewZero;
                _originalRemapFieldOfViewOne  = RemapFieldOfViewOne;
                _originalRelativeFieldOfView  = RelativeFieldOfView;
            }

            TimescaleMode        = timescaleMode;
            ShakeDuration        = duration;
            ShakeFieldOfView     = distortionCurve;
            RemapFieldOfViewZero = remapMin * feedbacksIntensity;
            RemapFieldOfViewOne  = remapMax * feedbacksIntensity;
            RelativeFieldOfView  = relativeDistortion;
            ForwardDirection     = forwardDirection;

            Play();
        }
Exemple #18
0
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="distance"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeDistance"></param>
        /// <param name="attenuation"></param>
        /// <param name="channel"></param>
        public virtual void OnPaniniProjectionShakeEvent(AnimationCurve distance, float duration, float remapMin, float remapMax, bool relativeDistance = false,
                                                         float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration     = ShakeDuration;
                _originalShakeDistance     = ShakeDistance;
                _originalRemapDistanceZero = RemapDistanceZero;
                _originalRemapDistanceOne  = RemapDistanceOne;
                _originalRelativeDistance  = RelativeDistance;
            }

            TimescaleMode     = timescaleMode;
            ShakeDuration     = duration;
            ShakeDistance     = distance;
            RemapDistanceZero = remapMin * attenuation;
            RemapDistanceOne  = remapMax * attenuation;
            RelativeDistance  = relativeDistance;
            ForwardDirection  = forwardDirection;

            Play();
        }
        /// <summary>
        /// When we get the appropriate event, we trigger a shake
        /// </summary>
        /// <param name="volumeCurve"></param>
        /// <param name="duration"></param>
        /// <param name="amplitude"></param>
        /// <param name="relativeVolume"></param>
        /// <param name="feedbacksIntensity"></param>
        /// <param name="channel"></param>
        public virtual void OnMMAudioSourceVolumeShakeEvent(AnimationCurve volumeCurve, float duration, float remapMin, float remapMax, bool relativeVolume = false,
                                                            float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
        {
            if (!CheckEventAllowed(channel) || (!Interruptible && Shaking))
            {
                return;
            }

            if (stop)
            {
                Stop();
                return;
            }

            _resetShakerValuesAfterShake = resetShakerValuesAfterShake;
            _resetTargetValuesAfterShake = resetTargetValuesAfterShake;

            if (resetShakerValuesAfterShake)
            {
                _originalShakeDuration   = ShakeDuration;
                _originalShakeVolume     = ShakeVolume;
                _originalRemapVolumeZero = RemapVolumeZero;
                _originalRemapVolumeOne  = RemapVolumeOne;
                _originalRelativeValues  = RelativeVolume;
            }

            TimescaleMode    = timescaleMode;
            ShakeDuration    = duration;
            ShakeVolume      = volumeCurve;
            RemapVolumeZero  = remapMin * feedbacksIntensity;
            RemapVolumeOne   = remapMax * feedbacksIntensity;
            RelativeVolume   = relativeVolume;
            ForwardDirection = forwardDirection;

            Play();
        }
 static public void Trigger(int channel, bool forceMaxPriority, int newPriority, bool forceTransition, CinemachineBlendDefinition blendDefinition, bool resetValuesAfterTransition, TimescaleModes timescaleMode)
 {
     OnEvent?.Invoke(channel, forceMaxPriority, newPriority, forceTransition, blendDefinition, resetValuesAfterTransition, timescaleMode);
 }
Exemple #21
0
 static public void Trigger(AnimationCurve distortionCurve, float duration, float remapMin, float remapMax, bool relativeDistortion = false,
                            float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled)
 {
     OnEvent?.Invoke(distortionCurve, duration, remapMin, remapMax, relativeDistortion,
                     feedbacksIntensity, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode);
 }
 static public void Trigger(AnimationCurve animNearCurve, float duration, float remapNearMin, float remapNearMax, AnimationCurve animFarCurve, float remapFarMin, float remapFarMax, bool relativeValue = false,
                            float feedbacksIntensity = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(animNearCurve, duration, remapNearMin, remapNearMax, animFarCurve, remapFarMin, remapFarMax, relativeValue,
                     feedbacksIntensity, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }
Exemple #23
0
 static public void Trigger(Color flashColor, float duration, float alpha, int flashID, int channel, TimescaleModes timescaleMode, bool stop = false)
 {
     OnEvent?.Invoke(flashColor, duration, alpha, flashID, channel, timescaleMode, stop);
 }
 static public void Trigger(AnimationCurve fixedExposure, float duration, float remapMin, float remapMax, bool relativeFixedExposure = false,
                            float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(fixedExposure, duration, remapMin, remapMax, relativeFixedExposure, attenuation, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }
 static public void Trigger(
     AnimationCurve shakeRed, float remapRedZero, float remapRedOne,
     AnimationCurve shakeGreen, float remapGreenZero, float remapGreenOne,
     AnimationCurve shakeBlue, float remapBlueZero, float remapBlueOne,
     float duration, bool relativeValues = false,
     float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(shakeRed, remapRedZero, remapRedOne,
                     shakeGreen, remapGreenZero, remapGreenOne,
                     shakeBlue, remapBlueZero, remapBlueOne,
                     duration, relativeValues, attenuation, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }
Exemple #26
0
 static public void Trigger(AnimationCurve shakePostExposure, float remapPostExposureZero, float remapPostExposureOne,
                            AnimationCurve shakeHueShift, float remapHueShiftZero, float remapHueShiftOne,
                            AnimationCurve shakeSaturation, float remapSaturationZero, float remapSaturationOne,
                            AnimationCurve shakeContrast, float remapContrastZero, float remapContrastOne,
                            MMColorAdjustmentsShaker_URP.ColorFilterModes colorFilterMode, Gradient colorFilterGradient, Color colorFilterDestination, AnimationCurve colorFilterCurve,
                            float duration, bool relativeValues = false,
                            float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled)
 {
     OnEvent?.Invoke(shakePostExposure, remapPostExposureZero, remapPostExposureOne,
                     shakeHueShift, remapHueShiftZero, remapHueShiftOne,
                     shakeSaturation, remapSaturationZero, remapSaturationOne,
                     shakeContrast, remapContrastZero, remapContrastOne,
                     colorFilterMode, colorFilterGradient, colorFilterDestination, colorFilterCurve,
                     duration, relativeValues, attenuation, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode);
 }
Exemple #27
0
 static public void Trigger(AnimationCurve temperature, float duration, float remapTemperatureMin, float remapTemperatureMax,
                            AnimationCurve tint, float remapTintMin, float remapTintMax, bool relativeValues = false,
                            float attenuation = 1.0f, int channel = 0, bool resetShakerValuesAfterShake = true, bool resetTargetValuesAfterShake = true, bool forwardDirection = true, TimescaleModes timescaleMode = TimescaleModes.Scaled, bool stop = false)
 {
     OnEvent?.Invoke(temperature, duration, remapTemperatureMin, remapTemperatureMax,
                     tint, remapTintMin, remapTintMax, relativeValues,
                     attenuation, channel, resetShakerValuesAfterShake, resetTargetValuesAfterShake, forwardDirection, timescaleMode, stop);
 }