少年修仙传客户端基础资源
lwb
2020-11-20 523a8c5b8de799aeaeaa7287f0b4f9e2edf339ee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/13
 
using System;
using DG.Tweening.Core;
using DG.Tweening.Plugins;
using UnityEngine;
 
#pragma warning disable 1591
namespace DG.Tweening
{
    public static class DOTweenProShortcuts
    {
        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
        }
 
        #region Shortcuts
 
        #region Transform
 
        /// <summary>Tweens a Transform's localPosition in a spiral shape.
        /// Also stores the transform as the tween's target 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 Transform 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.localPosition, x => target.localPosition = x, (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;
        }
 
        #endregion
 
#if true // PHYSICS_MARKER
        #region Rigidbody
 
        /// <summary>Tweens a Rigidbody's position in a spiral shape.
        /// Also stores the transform as the tween's target 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;
        }
 
        #endregion
#endif
 
        #endregion
    }
}