Ejemplo n.º 1
0
        // bounce up and down and rotate on z axis
        public void Shake(ShakeArgument argument)
        {
            if (_bounceState == BounceState.Static || _bounceState == BounceState.ToStatic)
            {
                _shakeEndTime = Time.time;
            }

            // time related calculations
            _shakeArgument = argument;
            _shakeEndTime  = Time.time + Random.Range(
                argument.minDuration,
                argument.maxDuration);
            _bounceState = BounceState.ToBouncing; // race condition vs Update solution
            _rotateState = RotateState.ToRotating;

            // position calculations
            _bounceOffset   = new Vector3(0, argument.bounceMax / 4); // todo: improve offset
            _sqrBounceSpeed = argument.bounceSpeed * argument.bounceSpeed;

            // rotation calculations
            _sqrRotationSpeed = argument.rotationSpeed * argument.rotationSpeed;
            halfAngleOffset   = argument.rotationMax / 2;
        }
Ejemplo n.º 2
0
 public void ProduceShakeEffect(ShakeArgument argument)
 {
     _cameraEffects.Shake(argument);
 }