Esempio n. 1
0
 public void CopyFrom(SmoothFollow2 sf2)
 {
     this.bControl           = sf2.bControl;
     this.bInUI              = sf2.bInUI;
     this.target             = sf2.target;
     this.targetRoot         = sf2.targetRoot;
     this.baseHeight         = sf2.baseHeight;
     this.height             = sf2.height;
     this.damping            = sf2.damping;
     this.rotationDamping    = sf2.rotationDamping;
     this.CenterOffset       = sf2.CenterOffset;
     this.CamDistance        = sf2.CamDistance;
     this.fieldOfView        = sf2.fieldOfView;
     this.CamPos             = sf2.CamPos;
     this.CamRot             = sf2.CamRot;
     this.FocalPos           = sf2.FocalPos;
     this.LastTargetPos      = sf2.LastTargetPos;
     this.LastWantedRotation = sf2.LastWantedRotation;
     this.charCtrl           = sf2.charCtrl;
     this.CanScroll          = sf2.CanScroll;
     this.shakeScript        = sf2.shakeScript;
     this.curShakeType       = sf2.curShakeType;
     this.HVByLoadArchive    = sf2.HVByLoadArchive;
     this.offsetScale        = sf2.offsetScale;
     this.TargetCamRot       = sf2.TargetCamRot;
     this.bJolt              = sf2.bJolt;
     this.lastAngleH         = sf2.lastAngleH;
     this.bNeedReturn        = sf2.bNeedReturn;
     this.ReturnSpeed        = sf2.ReturnSpeed;
     this.bUseLeftReturn     = sf2.bUseLeftReturn;
     this.CameraRadius       = sf2.CameraRadius;
     this.InsideFun          = sf2.InsideFun;
     this.horizontalRotSpeed = sf2.horizontalRotSpeed;
     this.verticalRotSpeed   = sf2.verticalRotSpeed;
     this.angleH             = sf2.angleH;
     this.angleV             = sf2.angleV;
     this.maxVerticalAngle   = sf2.maxVerticalAngle;
     this.minVerticalAngle   = sf2.minVerticalAngle;
     this.m_maxVerticalAngle = sf2.m_maxVerticalAngle;
     this.m_minVerticalAngle = sf2.m_minVerticalAngle;
     this.TargetCamDistance  = sf2.TargetCamDistance;
     this.MaxDistance        = sf2.MaxDistance;
     this.MinDistance        = sf2.MinDistance;
     this.currentDistance    = sf2.currentDistance;
     this.elasticSpeed       = sf2.elasticSpeed;
     this.ray        = sf2.ray;
     this.cullPlayer = sf2.cullPlayer;
     this.posOrig    = sf2.posOrig;
     this.posEnd     = sf2.posEnd;
     this.YSpeed     = sf2.YSpeed;
     this.UseYSpeed  = sf2.UseYSpeed;
     this.curY       = sf2.curY;
     this.BigMap_maxVerticalAngle  = sf2.BigMap_maxVerticalAngle;
     this.BigMap_verticalRotSpeed  = sf2.BigMap_verticalRotSpeed;
     this.BigMap_CamDistanceSpeed  = sf2.BigMap_CamDistanceSpeed;
     this.BigMap_maxVerticalAngleK = sf2.BigMap_maxVerticalAngleK;
     this.lastDistance             = sf2.lastDistance;
     this.lastVerticalAngle        = sf2.lastVerticalAngle;
     this.MiddleEvent = sf2.MiddleEvent;
 }
Esempio n. 2
0
 public void InitialiseShake(int seed, ShakeType shakeType)
 {
     this.interpolatedNoise = new InterpolatedNoise(seed);
     this.ShakeType         = shakeType;
     this.Position          = Vector3.zero;
     this.EulerRotation     = Vector3.zero;
 }
        public async Task Simulate(ShakeType shakeType)
        {
            bool activePreviousState = Active;

            await ThreadPool.RunAsync(
                async (o) =>
            {
                Active = false;

                Simulation.CallTo = OnAccelerometerHelperReadingChanged;

                await Task.Delay(TimeSpan.FromSeconds(1));

                switch (shakeType)
                {
                case ShakeType.X:
                    Simulation.SimulateShakeX();
                    break;

                case ShakeType.Y:
                    Simulation.SimulateShakeY();
                    break;

                case ShakeType.Z:
                    Simulation.SimulateShakeZ();
                    break;
                }
                Simulation.CallTo = null;

                Active = activePreviousState;
            });
        }
Esempio n. 4
0
 /// <summary>
 /// you can shake any combination of position, scale and eulers by passing in a bitmask of the types you want to shake. frameMod
 /// allows you to specify what frame count the shakes should occur on. for example, a frameMod of 3 would mean that only when
 /// frameCount % 3 == 0 will the shake occur
 /// </summary>
 public ShakeTweenProperty(Vector3 shakeMagnitude, ShakeType shakeType, int frameMod = 1, bool useLocalProperties = false) : base(true)
 {
     _shakeMagnitude     = shakeMagnitude;
     _shakeType          = shakeType;
     _frameMod           = frameMod;
     _useLocalProperties = useLocalProperties;
 }
Esempio n. 5
0
 public void StartShake(float shakeduration, float amplitude, ShakeType shakeType_)
 {
     shakeType      = shakeType_;
     shakeDuration  = shakeduration;
     ShakeAmplitude = amplitude;
     triggerShake   = true;
 }
        public void Simulate(ShakeType shakeType)
        {
            bool activePreviousState = Active;

            ThreadPool.QueueUserWorkItem(
                (o) =>
            {
                Active = false;

                Simulation.CallTo = OnAccelerometerHelperReadingChanged;

                Thread.Sleep(TimeSpan.FromSeconds(1));

                switch (shakeType)
                {
                case ShakeType.X:
                    Simulation.SimulateShakeX();
                    break;

                case ShakeType.Y:
                    Simulation.SimulateShakeY();
                    break;

                case ShakeType.Z:
                    Simulation.SimulateShakeZ();
                    break;
                }
                Simulation.CallTo = null;

                Active = activePreviousState;
            });
        }
        /// <summary>
        /// Shake all cameras associated with this component (using temporarily
        /// overriden settings), then call the specified callback once completed.
        /// </summary>
        /// <param name='shakeType'>The type of shake to perform (camera matrix
        /// or local position).</param>
        /// <param name='numberOfShakes'>The maximum number of shakes to
        /// perform.</param>
        /// <param name='shakeAmount'>The amount to shake in each
        /// direction.</param>
        /// <param name='rotationAmount'>The amount to rotate in each
        /// axis.</param>
        /// <param name='distance'>The initial distance for the first
        /// shake.</param>
        /// <param name='speed'>The speed multiplier for the shake.</param>
        /// <param name='decay'>The decay speed (between 0 and 1). Higher values
        /// will stop shaking sooner.</param>
        /// <param name='uiShakeModifier'>The modifier applied to speed in order
        /// to shake the UI.</param>
        /// <param name='multiplyByTimeScale'>If true, multiplies the shake
        /// speed by the time scale.</param>
        /// <param name='callback'>An action to invoke after the cameras have
        /// finished shaking.</param>
        public void Shake(
            ShakeType shakeType,
            int numberOfShakes,
            Vector3 shakeAmount,
            Vector3 rotationAmount,
            float distance,
            float speed,
            float decay,
            float uiShakeModifier,
            bool multiplyByTimeScale,
            System.Action callback)
        {
            var seed = Random.insideUnitSphere;

            for (int i = 0, camerasCount = cameras.Count; i < camerasCount; i++)
            {
                var cam = cameras[i];
                StartCoroutine(DoShake_Internal(cam,
                                                seed,
                                                shakeType,
                                                numberOfShakes,
                                                shakeAmount,
                                                rotationAmount,
                                                distance,
                                                speed,
                                                decay,
                                                uiShakeModifier,
                                                multiplyByTimeScale,
                                                callback));
            }
        }
Esempio n. 8
0
        protected internal override void NodeGUI()
        {
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Execute Next Node", GUILayout.Width(140));
            delayNextNode = EditorGUILayout.Popup(delayNextNode, new string[] { "When Action Finished", "At The Same Time" });
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("Performer ID", GUILayout.Width(140));
            performerID = EditorGUILayout.TextField(performerID);
            GUILayout.EndHorizontal();

            Rect temp = GUILayoutUtility.GetLastRect();

            Handles.DrawLine(new Vector2(temp.left, temp.bottom + 6), new Vector2(temp.right, temp.bottom + 6));

            GUILayout.Space(8);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Shake");
            shakeType = (ShakeType)EditorGUILayout.Popup((int)shakeType, new string[] { "Vertically", "Horizontally", "Randomly" }, GUILayout.Width(140));
            GUILayout.Label("For");
            duration = EditorGUILayout.FloatField(duration);
            GUILayout.Label("Seconds");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Intensity", GUILayout.Width(60));
            intensity = EditorGUILayout.FloatField(intensity, GUILayout.Width(40));
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
 /// <summary>
 /// Shake all cameras associated with all enabled Camera Shake
 /// components in the scene (using temporarily overriden settings), then
 /// call the specified callback once completed.
 /// </summary>
 /// <param name='shakeType'>The type of shake to perform (camera matrix
 /// or local position).</param>
 /// <param name='numberOfShakes'>The maximum number of shakes to
 /// perform.</param>
 /// <param name='shakeAmount'>The amount to shake in each
 /// direction.</param>
 /// <param name='rotationAmount'>The amount to rotate in each
 /// axis.</param>
 /// <param name='distance'>The initial distance for the first
 /// shake.</param>
 /// <param name='speed'>The speed multiplier for the shake.</param>
 /// <param name='decay'>The decay speed (between 0 and 1). Higher values
 /// will stop shaking sooner.</param>
 /// <param name='uiShakeModifier'>The modifier applied to speed in order
 /// to shake the UI.</param>
 /// <param name='multiplyByTimeScale'>If true, multiplies the shake
 /// speed by the time scale.</param>
 /// <param name='callback'>An action to invoke after the cameras have
 /// finished shaking.</param>
 public static void ShakeAll(
     ShakeType shakeType,
     int numberOfShakes,
     Vector3 shakeAmount,
     Vector3 rotationAmount,
     float distance,
     float speed,
     float decay,
     float uiShakeModifier,
     bool multiplyByTimeScale,
     System.Action callback)
 {
     for (int i = 0, m_ComponentsCount = m_Components.Count; i < m_ComponentsCount; i++)
     {
         var component = m_Components[i];
         component.Shake(shakeType,
                         numberOfShakes,
                         shakeAmount,
                         rotationAmount,
                         distance,
                         speed,
                         decay,
                         uiShakeModifier,
                         multiplyByTimeScale,
                         callback);
     }
 }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            ShakeType shakeType     = (ShakeType)value;
            string    expectedShake = (string)parameter;

            return((shakeType.ToString() == expectedShake) ? Visibility.Visible : Visibility.Collapsed);
        }
Esempio n. 11
0
 public void AddCustomShake(Vector2 input, ShakeType givShake)
 {
     m_velocity += input * typeArr[givShake].m_shakeVal;
     m_spring    = typeArr[givShake].m_springVal;
     m_damper    = typeArr[givShake].m_damperVal;
     m_shake     = typeArr[givShake].m_shakeVal;
     //m_velocity += new Vector2(Mathf.Clamp(m_velocity.x, minX, maxX), Mathf.Clamp(m_velocity, minY, maxY);)
 }
Esempio n. 12
0
 public void shakeCamera(ShakeType shakeType, float durationTime=1)
 {
     _shakeType = shakeType;
     origin = this.transform.position;
     conTime = durationTime;
     r_Time = Time.time;
     isShake = true;
 }
Esempio n. 13
0
    /// <summary>
    /// shake tween
    /// </summary>
    public TweenConfig shake(Vector3 shakeMagnitude, ShakeType shakeType = ShakeType.Position, int frameMod = 1, bool useLocalProperties = false)
    {
        var prop = new ShakeTweenProperty(shakeMagnitude, shakeType, frameMod, useLocalProperties);

        _tweenProperties.Add(prop);

        return(this);
    }
Esempio n. 14
0
 /// <summary>
 /// ÉãÏñ»úÕðÆÁЧ¹û
 /// </summary>
 /// <param name="shakeType"></param>
 public void StartShakeCamera(ShakeType shakeType)
 {
     ShakeCamera.Instance.StartByShakeType(transform, shakeType, () =>
     {
         m_startShake = false;
     });
     m_startShake = true;
 }
Esempio n. 15
0
 public void shakeCamera(ShakeType shakeType, float durationTime = 1)
 {
     _shakeType = shakeType;
     origin     = this.transform.position;
     conTime    = durationTime;
     r_Time     = Time.time;
     isShake    = true;
 }
Esempio n. 16
0
 void Awake()
 {
     shakeType = ShakeType.Sphere;
     if (camTransform == null)
     {
         camTransform = GetComponent(typeof(Transform)) as Transform;
     }
 }
Esempio n. 17
0
 /// <summary>
 /// you can shake any combination of position, scale and eulers by passing in a bitmask of the types you want to shake. frameMod
 /// allows you to specify what frame count the shakes should occur on. for example, a frameMod of 3 would mean that only when
 /// frameCount % 3 == 0 will the shake occur
 /// </summary>
 public ShakeTweenProperty( Vector3 shakeMagnitude, ShakeType shakeType, int frameMod = 1, bool useLocalProperties = false )
     : base(true)
 {
     _shakeMagnitude = shakeMagnitude;
     _shakeType = shakeType;
     _frameMod = frameMod;
     _useLocalProperties = useLocalProperties;
 }
Esempio n. 18
0
        private void _resetTimer_Tick(object sender, object e)
        {
            if (_resetTimer.IsEnabled)
            {
                _resetTimer.Stop();
            }

            CurrentShakeType = ShakeType.None;
        }
 private void Instance_ShakeGesture(object sender, ShakeGestureEventArgs e)
 {
     _lastUpdateTime.Dispatcher.BeginInvoke(
         () =>
         {
             _lastUpdateTime.Text = DateTime.Now.ToString();
             CurrentShakeType = e.ShakeType;
         });
     System.Diagnostics.Debug.WriteLine(DateTime.Now.Minute + ":" + DateTime.Now.Second + ":" + DateTime.Now.Millisecond + "  " + e.ShakeType);
 }
Esempio n. 20
0
    public void Shake(ShakeType type = ShakeType.ExplosionShake)
    {
        if (GameController.instance.gameState == GameController.GameState.gameover)
        {
            return;
        }
        var shakePreset = ProCamera2DShake.Instance.ShakePresets[(int)type];

        ProCamera2DShake.Instance.Shake(shakePreset);
    }
Esempio n. 21
0
    private ShakeNode GetShakeNode(ShakeType shakeType)
    {
        ShakeNode shakeNode = shakeNodes.Find(x => x.ShakeType == shakeType);

        if (shakeNode == null)
        {
            Debug.Log("No shake node exists with ShakeType " + shakeType.ToString() + " exists.");
        }
        return(shakeNodes.Find(x => x.ShakeType == shakeType));
    }
 internal ShakeState(ShakeType shakeType, Vector3 position, Quaternion rotation, Vector2 uiPosition)
 {
     _shakeType       = shakeType;
     _startPosition   = position;
     _startRotation   = rotation;
     _uiStartPosition = uiPosition;
     _shakePosition   = position;
     _shakeRotation   = rotation;
     _uiShakePosition = uiPosition;
 }
Esempio n. 23
0
 public void InitialiseShake(int seed, ShakeType shakeType, float shakeSpeedPosition, Vector3 shakeRangePosition, float shakeSpeedRotation, Vector3 shakeRangeRotation)
 {
     this.interpolatedNoise  = new InterpolatedNoise(seed);
     this.shakeSpeedPosition = shakeSpeedPosition;
     this.shakeRangePosition = shakeRangePosition;
     this.shakeSpeedRotation = shakeSpeedRotation;
     this.shakeRangeRotation = shakeRangeRotation;
     this.ShakeType          = shakeType;
     this.Position           = Vector3.zero;
     this.EulerRotation      = Vector3.zero;
 }
    public void Init(float amplitude, float frequency, float duration, AnimationCurve blendOverLifetime, ShakeType shakeType)
    {
        this.shakeType = shakeType;

        this.amplitude = amplitude;
        this.frequency = frequency;

        this.duration = duration;

        this.blendOverLifetime = blendOverLifetime;
    }
Esempio n. 25
0
 public void UpdateData(CameraShakeData data)
 {
     if (data != null)
     {
         mShakeType    = data.mShakeType;
         mNoiseType    = data.mNoiseType;
         MoveExtents   = data.MoveExtents;
         RotateExtents = data.RotateExtents;
         Speed         = data.Speed;
         Duration      = data.Duration;
     }
 }
Esempio n. 26
0
    public void ShakeOut(ShakeType shakeType, Action onShakeOutCompleted = null)
    {
        StopShake();

        ShakeNode shakeNode = GetShakeNode(shakeType);

        moveShakeStrengthCoroutine = StartCoroutine(MoveShakeStrength(shakeNode.ShakeOutData, onShakeOutCompleted));
        if (shakeCoroutine == null)
        {
            shakeCoroutine = StartCoroutine(Shake());
        }
    }
Esempio n. 27
0
	public void StartShake( ShakeType type ) {
	    if(!shaking) {
	        switch(type) {
	            case ShakeType.rumble:       Rumble();          break;
	            case ShakeType.explosion:    Explosion();       break;
	            case ShakeType.earthquake:   Earthquake();      break;
	            case ShakeType.random: 		 RandomShake(); 	break;
	            case ShakeType.custom: 		 CustomShake(); 	break;
	            default:  					 DefaultShake();    break;                   
	        }
	    }
	}
Esempio n. 28
0
        public ShakeParameters(IShakeParameters original)
        {
            shakeType = original.ShakeType;

            strength  = original.Strength;
            roughness = original.Roughness;

            fadeIn  = original.FadeIn;
            fadeOut = original.FadeOut;

            positionInfluence = original.PositionInfluence;
            rotationInfluence = original.RotationInfluence;
        }
Esempio n. 29
0
        // Token: 0x0600009A RID: 154 RVA: 0x00004188 File Offset: 0x00002388
        private void ShakeCamera(ShakeType shakeType = ShakeType.EnemyKillShake)
        {
            Renderer renderer = base.GetComponent <Renderer>();

            if (renderer == null)
            {
                renderer = base.GetComponentInChildren <Renderer>();
            }
            if (renderer != null && renderer.isVisible)
            {
                CameraShaker.Instance.Shake(shakeType);
            }
        }
Esempio n. 30
0
 public void DoShake(ShakeType type)
 {
     for (int i = 0; i < ShakeInfos.Length; i++)
     {
         if (ShakeInfos[i].Type.Equals(type))
         {
             ShakeIntensity   = ShakeInfos[i].ShakeIntensity;
             ShakeDecay       = ShakeInfos[i].ShakeDecay;
             currentIntensity = ShakeIntensity;
             Shaking          = true;
             return;
         }
     }
 }
Esempio n. 31
0
        public static Shake GetShake(ShakeType type)
        {
            switch (type)
            {
            case ShakeType.CocoaShake:
                return(new CocoaShake());

            case ShakeType.MilkShake:
                return(new MilkShake());

            default:
                return(null);
            }
        }
Esempio n. 32
0
        public ShakeInfo GetShakeInfo(ShakeType type)
        {
            ShakeInfo result = default;

            foreach (var shakeData in _shakes)
            {
                if (shakeData.ShakeType == type)
                {
                    result = shakeData.ShakeInfo;
                }
            }

            return(result);
        }
        public static void AnimationShake(this UIView view, ShakeType type = ShakeType.Horizontal, int count = 2,
                                          double duration = 0.2f, float withTranslation = -5f)
        {
            var animation = new CABasicAnimation
            {
                KeyPath        = $"transform.translation.{(type == ShakeType.Horizontal ? "x" : "y")}",
                TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.Linear),
                RepeatCount    = count,
                Duration       = duration / count,
                AutoReverses   = true,
                By             = new NSNumber(withTranslation)
            };

            view.Layer.AddAnimation(animation, "shake");
        }
Esempio n. 34
0
    public void ShakeInDirectionWithIntensity(Vector3 direction, float intensity, ShakeType type = ShakeType.Default)
    {
        if (!enabled || (shaking && type == shakeType && type == ShakeType.Rumble))
        {
            return;
        }

        shaking        = true;
        shakeType      = type;
        shakeDirection = direction;
        animationTime  = 0f;
        this.intensity = intensity;
        Invoke("StopShaking", duration);
        originalPosition = transform.localPosition;
    }
Esempio n. 35
0
 public static Tween shake( this Transform self, float duration, Vector3 shakeMagnitude, ShakeType shakeType = ShakeType.Position, int frameMod = 1 )
 {
     return Go.to( self, duration, new TweenConfig().shake( shakeMagnitude, shakeType, frameMod ) );
 }
 public ShakeGestureEventArgs(ShakeType shakeType)
 {
     _shakeType = shakeType;
 }
Esempio n. 37
0
    /// <summary>
    /// shake tween
    /// </summary>
    public TweenConfig shake( Vector3 shakeMagnitude, ShakeType shakeType = ShakeType.Position, int frameMod = 1, bool useLocalProperties = false )
    {
        var prop = new ShakeTweenProperty( shakeMagnitude, shakeType, frameMod, useLocalProperties );
        _tweenProperties.Add( prop );

        return this;
    }
Esempio n. 38
0
        /// <summary>
        /// Count how many shakes the shake signal contains
        /// </summary>
        private int CountSignChanges(ShakeType shakeType)
        {
            int countSignsChanges = 0;
            int currentSign = 0;
            int? prevSign = null;

            for (int i = 0; i < _shakeSignal.Count; ++i)
            {
                // get sign of current vector
                switch (shakeType)
                {
                    case ShakeType.X:
                        currentSign = Math.Sign(_shakeSignal[i].X);
                        break;

                    case ShakeType.Y:
                        currentSign = Math.Sign(_shakeSignal[i].Y);
                        break;

                    case ShakeType.Z:
                        currentSign = Math.Sign(_shakeSignal[i].Z);
                        break;
                }

                // skip sign-less vectors
                if (currentSign == 0)
                {
                    continue;
                }

                // handle sign for first vector
                if (prevSign == null)
                {
                    prevSign = currentSign;
                }

                // check if sign changed
                if (currentSign != prevSign)
                {
                    ++countSignsChanges;
                }

                // save previous sign
                prevSign = currentSign;
            }

            return countSignsChanges;
        }
Esempio n. 39
0
        public void Simulate(ShakeType shakeType)
        {
            bool activePreviousState = Active;

            ThreadPool.QueueUserWorkItem(
                (o) =>
                {
                    Active = false;

                    Simulation.CallTo = OnAccelerometerHelperReadingChanged;

                    Thread.Sleep(TimeSpan.FromSeconds(1));

                    switch (shakeType)
                    {
                        case ShakeType.X:
                            Simulation.SimulateShakeX();
                            break;

                        case ShakeType.Y:
                            Simulation.SimulateShakeY();
                            break;

                        case ShakeType.Z:
                            Simulation.SimulateShakeZ();
                            break;
                    }
                    Simulation.CallTo = null;

                    Active = activePreviousState;
                });
        }