static DOTweenProShortcuts()
        {
            // Create stub instances of custom plugins, in order to allow IL2CPP to understand they must be included in the build
#pragma warning disable 219
            SpiralPlugin stub = new SpiralPlugin();
#pragma warning restore 219
        }
Пример #2
0
        // Methods
        public static Tweener DOSpiral(this Rigidbody target, float duration, Vector3?axis = null, SpiralMode mode = SpiralMode.Expand, float speed = 1f, float frequency = 10f, float depth = 0f, bool snapping = false)
        {
            TweenerCore <Vector3, Vector3, SpiralOptions> local1;

            if (Mathf.Approximately(speed, 0f))
            {
                speed = 1f;
            }
            if (axis.HasValue)
            {
                Vector3?nullable = axis;
                Vector3 zero     = Vector3.zero;
                if (!(nullable.HasValue ? (nullable.HasValue ? (nullable.GetValueOrDefault() == zero) : true) : false))
                {
                    goto Label_0066;
                }
            }
            axis = new Vector3?(Vector3.forward);
            Label_0066:
            local1 = DOTween.To <Vector3, Vector3, SpiralOptions>(SpiralPlugin.Get(), () => target.position, new DOSetter <Vector3>(target.MovePosition), axis.Value, duration).SetTarget <TweenerCore <Vector3, Vector3, SpiralOptions> >(target);
            local1.plugOptions.mode      = mode;
            local1.plugOptions.speed     = speed;
            local1.plugOptions.frequency = frequency;
            local1.plugOptions.depth     = depth;
            local1.plugOptions.snapping  = snapping;
            return(local1);
        }
Пример #3
0
        public static Tweener DOSpiral(this Rigidbody target, float duration, Vector3?axis = default(Vector3?), SpiralMode mode = SpiralMode.Expand, float speed = 1f, float frequency = 10f, float depth = 0f, bool snapping = false)
        {
            if (Mathf.Approximately(speed, 0f))
            {
                speed = 1f;
            }
            if (!axis.HasValue || axis == (Vector3?)Vector3.zero)
            {
                axis = Vector3.forward;
            }
            TweenerCore <Vector3, Vector3, SpiralOptions> tweenerCore = DOTween.To(SpiralPlugin.Get(), () => target.position, target.MovePosition, axis.Value, duration).SetTarget(target);

            tweenerCore.plugOptions.mode      = mode;
            tweenerCore.plugOptions.speed     = speed;
            tweenerCore.plugOptions.frequency = frequency;
            tweenerCore.plugOptions.depth     = depth;
            tweenerCore.plugOptions.snapping  = snapping;
            return(tweenerCore);
        }
        /// <summary>Tweens a Rigidbody's position in a spiral shape.
        /// Also stores the transform as the tween's inTarget so it can be used for filtered operations</summary>
        /// <param name="duration">The duration of the tween</param>
        /// <param name="axis">The axis around which the spiral will rotate</param>
        /// <param name="mode">The type of spiral movement</param>
        /// <param name="speed">Speed of the rotations</param>
        /// <param name="frequency">Frequency of the rotation. Lower values lead to wider spirals</param>
        /// <param name="depth">Indicates how much the tween should move along the spiral's axis</param>
        /// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
        public static Tweener DOSpiral(
            this Rigidbody target, float duration, Vector3?axis = null, SpiralMode mode = SpiralMode.Expand,
            float speed = 1, float frequency = 10, float depth = 0, bool snapping = false
            )
        {
            if (Mathf.Approximately(speed, 0))
            {
                speed = 1;
            }
            if (axis == null || axis == Vector3.zero)
            {
                axis = Vector3.forward;
            }

            TweenerCore <Vector3, Vector3, SpiralOptions> t = DOTween.To(SpiralPlugin.Get(), () => target.position, target.MovePosition, (Vector3)axis, duration)
                                                              .SetTarget(target);

            t.plugOptions.mode      = mode;
            t.plugOptions.speed     = speed;
            t.plugOptions.frequency = frequency;
            t.plugOptions.depth     = depth;
            t.plugOptions.snapping  = snapping;
            return(t);
        }
        public static Tweener DOSpiral(this Rigidbody target, float duration, Vector3?axis = null, SpiralMode mode = SpiralMode.Expand, float speed = 1f, float frequency = 10f, float depth = 0f, bool snapping = false)
        {
            if (Mathf.Approximately(speed, 0f))
            {
                speed = 1f;
            }
            if (axis.HasValue)
            {
                Vector3?vector = axis;
                Vector3 zero   = Vector3.zero;
                if (!vector.HasValue || (vector.HasValue && !(vector.GetValueOrDefault() == zero)))
                {
                    goto IL_66;
                }
            }
            axis = new Vector3?(Vector3.forward);
            IL_66:
            TweenerCore <Vector3, Vector3, SpiralOptions> expr_A0 = DOTween.To <Vector3, Vector3, SpiralOptions>(SpiralPlugin.Get(), () => target.position, new DOSetter <Vector3>(target.MovePosition), axis.Value, duration).SetTarget(target);

            expr_A0.plugOptions.mode      = mode;
            expr_A0.plugOptions.speed     = speed;
            expr_A0.plugOptions.frequency = frequency;
            expr_A0.plugOptions.depth     = depth;
            expr_A0.plugOptions.snapping  = snapping;
            return(expr_A0);
        }