示例#1
0
        public static TweenShake Shake(Transform transform, TweenShakeArgs shakeArgs, float duration, bool worldSpace = true)
        {
            var tween = Do <TweenShake, float, Transform>(transform, 1f, 0f, duration);

            tween.ShakeArgs  = shakeArgs;
            tween.WorldSpace = worldSpace;
            return(tween);
        }
示例#2
0
 public override void Reset()
 {
     base.Reset();
     // 弹性从小到大,所以从 1 -> 0 插值
     From      = 1f;
     To        = 0f;
     ShakeArgs = new TweenShakeArgs();
 }
示例#3
0
        public static TweenShake Shake(Transform transform, Vector3 powerPos, Vector3 powerRot, Vector3 powerScale, int count, float duration, bool worldSpace = true)
        {
            var shakeArgs = new TweenShakeArgs(powerPos, powerRot, powerScale, count);
            var tween     = Shake(transform, shakeArgs, duration);

            tween.WorldSpace = worldSpace;
            return(tween);
        }
示例#4
0
 public override void Awake()
 {
     CacheStartStatus();
     if (ShakeArgs == null)
     {
         ShakeArgs = new TweenShakeArgs();
     }
     base.Awake();
 }
示例#5
0
        public void ResetValue()
        {
            Type       = TweenType.None;
            Identifier = "";

            FromFloat      = 0f;
            ToFloat        = 1f;
            FromVector2    = Vector2.zero;
            ToVector2      = Vector2.one;
            FromVector3    = Vector3.zero;
            ToVector3      = Vector3.one;
            FromVector4    = Vector4.zero;
            ToVector4      = Vector4.one;
            FromColor      = Color.black;
            ToColor        = Color.white;
            FromQuaternion = Quaternion.identity;
            ToQuaternion   = Quaternion.identity;
            FromRect       = Rect.zero;
            ToRect         = Rect.zero;
            FromTransform  = null;
            ToTransform    = null;

            QueueVector3.Clear();
            QueueColor.Clear();

            CurveMode   = CurveMode.Single;
            CurveTarget = CurveTargetType.Factor;
            Curve       = TweenSetting.Ins.DefaultCurve;
            CurveX      = TweenSetting.Ins.DefaultCurve;
            CurveY      = TweenSetting.Ins.DefaultCurve;
            CurveZ      = TweenSetting.Ins.DefaultCurve;
            CurveW      = TweenSetting.Ins.DefaultCurve;

            PlayType   = PlayType.Once;
            EaseType   = TweenSetting.Ins.DefaultEaseType;
            LoopCount  = 0;
            Duration   = 1f;
            Interval   = 0f;
            SpeedBased = false;
            StartDelay = 0f;
            AutoPlay   = TweenSetting.Ins.DefaultAutoPlayType;
            UpdateType = TweenSetting.Ins.DefaultUpdateType;
            TimeScale  = TweenSetting.Ins.DefaultTimeScale;
            TimeSmooth = TweenSetting.Ins.DefaultTimeSmooth;
            SelfScale  = 1f;
            AutoKill   = false;

            WorldSpace     = true;
            ColorLerpMode  = ColorLerpMode.RGB;
            ColorBlockType = ColorBlockType.NormalColor;
            PathMode       = PathMode.PointToPoint;
            ShakeArgs      = new TweenShakeArgs();

            ResourcesIndex = 0;
            ResourcesKey   = "";
        }
示例#6
0
        public void CopyFrom(TweenParam param)
        {
            Type       = param.Type;
            Identifier = param.Identifier;

            CopyFromToValueFrom(param);

            CurveMode   = param.CurveMode;
            CurveTarget = param.CurveTarget;
            Curve       = param.Curve;
            CurveX      = param.CurveX;
            CurveY      = param.CurveY;
            CurveZ      = param.CurveZ;
            CurveW      = param.CurveW;

            PlayType   = param.PlayType;
            EaseType   = param.EaseType;
            LoopCount  = param.LoopCount;
            Duration   = param.Duration;
            Interval   = param.Interval;
            SpeedBased = param.SpeedBased;
            StartDelay = param.StartDelay;
            AutoPlay   = param.AutoPlay;
            UpdateType = param.UpdateType;
            TimeScale  = param.TimeScale;
            TimeSmooth = param.TimeSmooth;
            SelfScale  = param.SelfScale;
            AutoKill   = param.AutoKill;

            WorldSpace     = param.WorldSpace;
            ColorLerpMode  = param.ColorLerpMode;
            ColorBlockType = param.ColorBlockType;
            PathMode       = param.PathMode;
            ShakeArgs      = param.ShakeArgs;

            ResourcesIndex = param.ResourcesIndex;
            ResourcesKey   = param.ResourcesKey;

            OnPlay         = param.OnPlay;
            OnStop         = param.OnStop;
            OnValueFloat   = param.OnValueFloat;
            OnValueVector2 = param.OnValueVector2;
            OnValueVector3 = param.OnValueVector3;
            OnValueColor   = param.OnValueColor;
        }
 public static T SetShakeArgs <T>(this T tween, TweenShakeArgs args) where T : TweenShake
 {
     tween.ShakeArgs = args;
     return(tween);
 }
示例#8
0
        public static TweenShake Shake(this Transform transform, TweenShakeArgs shakeArgs, float duration, bool worldSpace = true)
        {
            var tween = UTween.Shake(transform, shakeArgs, duration, worldSpace);

            return(tween);
        }