Nez.Portable/ECS/Components/CameraShake.cs
/// <summary>
/// if the shake is already running this will overwrite the current values only if shakeIntensity > the current shakeIntensity.
/// if the shake is not currently active it will be started.
/// </summary>
/// <param name="shakeIntensity">how much should we shake it</param>
/// <param name="shakeDegredation">higher values cause faster degradation</param>
/// <param name="shakeDirection">Vector3.zero will result in a shake on just the x/y axis. any other values will result in the passed
/// in shakeDirection * intensity being the offset the camera is moved</param>
if the shake is already running this will overwrite the current values only if shakeIntensity > the current shakeIntensity.
if the shake is not currently active it will be started.
if the shake is already running this will overwrite the current values only if shakeIntensity > the current shakeIntensity . if the shake is not currently active it will be started .
public void shake(
            float shakeIntensity = 15f,
            float shakeDegredation = 0.9f,
            Vector2 shakeDirection = default(Vector2))
        {
            enabled = true;
            if (_shakeIntensity < shakeIntensity)
            {
                _shakeDirection = shakeDirection;
                _shakeIntensity = shakeIntensity;
                if (shakeDegredation < 0f || shakeDegredation >= 1f)
                    shakeDegredation = 0.95f;
                _shakeDegredation = shakeDegredation;
            }
        }
public void shake ( float shakeIntensity = 15f , float shakeDegredation = 0.9f , Vector2 shakeDirection = default ( Vector2 ) ) { enabled = true ; if ( _shakeIntensity < shakeIntensity ) { _shakeDirection = shakeDirection ; _shakeIntensity = shakeIntensity ; if ( shakeDegredation < 0f || shakeDegredation >= 1f ) shakeDegredation = 0.95f ; _shakeDegredation = shakeDegredation ; } }
if the shake is already running this will overwrite the current values only if shakeIntensity > the current shakeIntensity.
if the shake is already running this will overwrite the current values only if shakeIntensity > the current shakeIntensity .
shakeIntensity
float
None
shakeDegredation
float
higher values cause faster degradation
higher values cause faster degradation
shakeDirection
Vector2
Vector3.zero will result in a shake on just the x/y axis. any other values will result in the passed
in shakeDirection * intensity being the offset the camera is moved
Vector3 . zero will result in a shake on just the x / y axis . any other values will result in the passed in shakeDirection * intensity being the offset the camera is moved