示例#1
1
	IEnumerator Start()
	{
		yield return new WaitForSeconds(0.5f);

		TweenParams tp = new TweenParams()
			.SetRelative()
			// .SetSpeedBased()
			.SetEase(Ease.OutQuint)
			.SetLoops(-1, LoopType.Yoyo);

		foreach (Transform t in ts) {
			t.DOMoveY(2, 1).SetAs(tp);
		}
	}
示例#2
1
 /// <summary>
 /// gameOver時の演出開始.
 /// </summary>
 public void StartGameOverTween(System.Action callBack)
 {
     Sequence seq = DOTween.Sequence ();
     Transform targetT = gameOverLabel.transform;
     TweenParams tParams = new TweenParams ().SetLoops (0).SetEase (Ease.OutBounce);
     seq.Append (targetT.DOLocalMoveY (0f, 1f)).SetAs (tParams)
         .Append (targetT.DOLocalMoveY (0f, 0.5f))
         .AppendCallback (() => ResetGameOverPos ())
         .AppendCallback (() => OpenShowResultPanel(callBack));
 }
示例#3
0
 static int QPYX_SetAs_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, DG.Tweening.Tween>(L_YXQP, 1))
         {
             DG.Tweening.Tweener QPYX_obj_YXQP  = (DG.Tweening.Tweener)ToLua.ToObject(L_YXQP, 1);
             DG.Tweening.Tween   QPYX_arg0_YXQP = (DG.Tweening.Tween)ToLua.ToObject(L_YXQP, 2);
             DG.Tweening.Tween   QPYX_o_YXQP    = QPYX_obj_YXQP.SetAs(QPYX_arg0_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, DG.Tweening.TweenParams>(L_YXQP, 1))
         {
             DG.Tweening.Tweener     QPYX_obj_YXQP  = (DG.Tweening.Tweener)ToLua.ToObject(L_YXQP, 1);
             DG.Tweening.TweenParams QPYX_arg0_YXQP = (DG.Tweening.TweenParams)ToLua.ToObject(L_YXQP, 2);
             DG.Tweening.Tween       QPYX_o_YXQP    = QPYX_obj_YXQP.SetAs(QPYX_arg0_YXQP);
             ToLua.PushObject(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: DG.Tweening.Tweener.SetAs"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
示例#4
0
        /// <summary>Sets the parameters of the tween (id, ease, loops, delay, timeScale, callbacks, etc) as the parameters of the given TweenParams.
        /// <para>Has no effect if the tween has already started.</para></summary>
        /// <param name="tweenParams">TweenParams from which to copy the parameters</param>
        public static T SetAs <T>(this T t, TweenParams tweenParams) where T : Tween
        {
            if (t == null || !t.active || t.creationLocked)
            {
                return(t);
            }

            TweenManager.SetUpdateType(t, tweenParams.updateType, tweenParams.isIndependentUpdate);
            t.id               = tweenParams.id;
            t.onStart          = tweenParams.onStart;
            t.onPlay           = tweenParams.onPlay;
            t.onRewind         = tweenParams.onRewind;
            t.onUpdate         = tweenParams.onUpdate;
            t.onStepComplete   = tweenParams.onStepComplete;
            t.onComplete       = tweenParams.onComplete;
            t.onKill           = tweenParams.onKill;
            t.onWaypointChange = tweenParams.onWaypointChange;

            t.isRecyclable = tweenParams.isRecyclable;
            t.isSpeedBased = tweenParams.isSpeedBased;
            t.autoKill     = tweenParams.autoKill;
            t.loops        = tweenParams.loops;
            t.loopType     = tweenParams.loopType;
            if (t.tweenType == TweenType.Tweener)
            {
                if (t.loops > -1)
                {
                    t.fullDuration = t.duration * t.loops;
                }
                else
                {
                    t.fullDuration = Mathf.Infinity;
                }
            }

            t.delay         = tweenParams.delay;
            t.delayComplete = t.delay <= 0;
            t.isRelative    = tweenParams.isRelative;
            if (tweenParams.easeType == Ease.Unset)
            {
                if (t.tweenType == TweenType.Sequence)
                {
                    t.easeType = Ease.Linear;
                }
                else
                {
                    t.easeType = DOTween.defaultEaseType;
                }
//                t.easeType = t.tweenType == TweenType.Sequence ? Ease.Linear : DOTween.defaultEaseType; // Doesn't work w webplayer (why?)
            }
            else
            {
                t.easeType = tweenParams.easeType;
            }
            t.customEase = tweenParams.customEase;
            t.easeOvershootOrAmplitude = tweenParams.easeOvershootOrAmplitude;
            t.easePeriod = tweenParams.easePeriod;

            return(t);
        }
    static int SetAs(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, DG.Tweening.TweenParams>(L, 1))
            {
                DG.Tweening.Tweener     obj  = (DG.Tweening.Tweener)ToLua.ToObject(L, 1);
                DG.Tweening.TweenParams arg0 = (DG.Tweening.TweenParams)ToLua.ToObject(L, 2);
                DG.Tweening.Tween       o    = obj.SetAs(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.Tween, DG.Tweening.Tween>(L, 1))
            {
                DG.Tweening.Tweener obj  = (DG.Tweening.Tweener)ToLua.ToObject(L, 1);
                DG.Tweening.Tween   arg0 = (DG.Tweening.Tween)ToLua.ToObject(L, 2);
                DG.Tweening.Tween   o    = obj.SetAs(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.Tweener.SetAs"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int SetAs(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(DG.Tweening.Tween), typeof(DG.Tweening.TweenParams)))
        {
            DG.Tweening.Tween       obj  = (DG.Tweening.Tween)LuaScriptMgr.GetNetObjectSelf(L, 1, "DG.Tweening.Tween");
            DG.Tweening.TweenParams arg0 = (DG.Tweening.TweenParams)LuaScriptMgr.GetLuaObject(L, 2);
            DG.Tweening.Tween       o    = obj.SetAs(arg0);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else if (count == 2 && LuaScriptMgr.CheckTypes(L, 1, typeof(DG.Tweening.Tween), typeof(DG.Tweening.Tween)))
        {
            DG.Tweening.Tween obj  = (DG.Tweening.Tween)LuaScriptMgr.GetNetObjectSelf(L, 1, "DG.Tweening.Tween");
            DG.Tweening.Tween arg0 = (DG.Tweening.Tween)LuaScriptMgr.GetLuaObject(L, 2);
            DG.Tweening.Tween o    = obj.SetAs(arg0);
            LuaScriptMgr.PushObject(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: DG.Tweening.Tween.SetAs");
        }

        return(0);
    }
    public void Awake()
    {
        // Cache default anim values
        this.rectTransform = GetComponent<RectTransform>();
        this.pivotY = this.rectTransform.pivot.y;

        // Set anim settings
        this.slideAnimParams = new TweenParams().SetEase(Ease.InOutExpo);
    }
 public static T SetAs <T>(this T t, TweenParams tweenParams) where T : Tween
 {
     if (t != null && ((Tween)(object)t).active && !((Tween)(object)t).creationLocked)
     {
         TweenManager.SetUpdateType((Tween)(object)t, tweenParams.updateType, tweenParams.isIndependentUpdate);
         ((Tween)(object)t).id = tweenParams.id;
         ((ABSSequentiable)(object)t).onStart = tweenParams.onStart;
         ((Tween)(object)t).onPlay            = tweenParams.onPlay;
         ((Tween)(object)t).onRewind          = tweenParams.onRewind;
         ((Tween)(object)t).onUpdate          = tweenParams.onUpdate;
         ((Tween)(object)t).onStepComplete    = tweenParams.onStepComplete;
         ((Tween)(object)t).onComplete        = tweenParams.onComplete;
         ((Tween)(object)t).onKill            = tweenParams.onKill;
         ((Tween)(object)t).onWaypointChange  = tweenParams.onWaypointChange;
         ((Tween)(object)t).isRecyclable      = tweenParams.isRecyclable;
         ((Tween)(object)t).isSpeedBased      = tweenParams.isSpeedBased;
         ((Tween)(object)t).autoKill          = tweenParams.autoKill;
         ((Tween)(object)t).loops             = tweenParams.loops;
         ((Tween)(object)t).loopType          = tweenParams.loopType;
         if (((ABSSequentiable)(object)t).tweenType == TweenType.Tweener)
         {
             if (((Tween)(object)t).loops > -1)
             {
                 ((Tween)(object)t).fullDuration = ((Tween)(object)t).duration * (float)((Tween)(object)t).loops;
             }
             else
             {
                 ((Tween)(object)t).fullDuration = float.PositiveInfinity;
             }
         }
         ((Tween)(object)t).delay         = tweenParams.delay;
         ((Tween)(object)t).delayComplete = (((Tween)(object)t).delay <= 0f);
         ((Tween)(object)t).isRelative    = tweenParams.isRelative;
         if (tweenParams.easeType == Ease.Unset)
         {
             if (((ABSSequentiable)(object)t).tweenType == TweenType.Sequence)
             {
                 ((Tween)(object)t).easeType = Ease.Linear;
             }
             else
             {
                 ((Tween)(object)t).easeType = DOTween.defaultEaseType;
             }
         }
         else
         {
             ((Tween)(object)t).easeType = tweenParams.easeType;
         }
         ((Tween)(object)t).customEase = tweenParams.customEase;
         ((Tween)(object)t).easeOvershootOrAmplitude = tweenParams.easeOvershootOrAmplitude;
         ((Tween)(object)t).easePeriod = tweenParams.easePeriod;
         return(t);
     }
     return(t);
 }
 static int SetAutoKill(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.TweenParams obj = (DG.Tweening.TweenParams)ToLua.CheckObject(L, 1, typeof(DG.Tweening.TweenParams));
         bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
         DG.Tweening.TweenParams o = obj.SetAutoKill(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static int SetLoops(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.TweenParams obj = (DG.Tweening.TweenParams)ToLua.CheckObject(L, 1, typeof(DG.Tweening.TweenParams));
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.TweenParams o = obj.SetLoops(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#11
0
 static int SetTarget(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.TweenParams obj = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
         object arg0 = ToLua.ToVarObject(L, 2);
         DG.Tweening.TweenParams o = obj.SetTarget(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#12
0
 static int SetDelay(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.TweenParams obj = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
         float arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         DG.Tweening.TweenParams o = obj.SetDelay(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#13
0
 static int OnWaypointChange(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DG.Tweening.TweenParams         obj  = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
         DG.Tweening.TweenCallback <int> arg0 = (DG.Tweening.TweenCallback <int>)ToLua.CheckDelegate <DG.Tweening.TweenCallback <int> >(L, 2);
         DG.Tweening.TweenParams         o    = obj.OnWaypointChange(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 static public int SetLoops(IntPtr l)
 {
     try {
         DG.Tweening.TweenParams self = (DG.Tweening.TweenParams)checkSelf(l);
         System.Int32            a1;
         checkType(l, 2, out a1);
         System.Nullable <DG.Tweening.LoopType> a2;
         checkNullable(l, 3, out a2);
         var ret = self.SetLoops(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int SetEase(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(DG.Tweening.EaseFunction)))
         {
             DG.Tweening.TweenParams  self = (DG.Tweening.TweenParams)checkSelf(l);
             DG.Tweening.EaseFunction a1;
             checkDelegate(l, 2, out a1);
             var ret = self.SetEase(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (matchType(l, argc, 2, typeof(UnityEngine.AnimationCurve)))
         {
             DG.Tweening.TweenParams    self = (DG.Tweening.TweenParams)checkSelf(l);
             UnityEngine.AnimationCurve a1;
             checkType(l, 2, out a1);
             var ret = self.SetEase(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 4)
         {
             DG.Tweening.TweenParams self = (DG.Tweening.TweenParams)checkSelf(l);
             DG.Tweening.Ease        a1;
             checkEnum(l, 2, out a1);
             System.Nullable <System.Single> a2;
             checkNullable(l, 3, out a2);
             System.Nullable <System.Single> a3;
             checkNullable(l, 4, out a3);
             var ret = self.SetEase(a1, a2, a3);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function SetEase to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#16
0
 static int SetLoops(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         DG.Tweening.TweenParams obj = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         System.Nullable <DG.Tweening.LoopType> arg1 = ToLua.CheckNullable <DG.Tweening.LoopType>(L, 3);
         DG.Tweening.TweenParams o = obj.SetLoops(arg0, arg1);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#17
0
    static int SetEase(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.EaseFunction>(L, 2))
            {
                DG.Tweening.TweenParams  obj  = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
                DG.Tweening.EaseFunction arg0 = (DG.Tweening.EaseFunction)ToLua.ToObject(L, 2);
                DG.Tweening.TweenParams  o    = obj.SetEase(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <UnityEngine.AnimationCurve>(L, 2))
            {
                DG.Tweening.TweenParams    obj  = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
                UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.ToObject(L, 2);
                DG.Tweening.TweenParams    o    = obj.SetEase(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 4)
            {
                DG.Tweening.TweenParams obj  = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
                DG.Tweening.Ease        arg0 = (DG.Tweening.Ease)ToLua.CheckObject(L, 2, typeof(DG.Tweening.Ease));
                System.Nullable <float> arg1 = ToLua.CheckNullable <float>(L, 3);
                System.Nullable <float> arg2 = ToLua.CheckNullable <float>(L, 4);
                DG.Tweening.TweenParams o    = obj.SetEase(arg0, arg1, arg2);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.TweenParams.SetEase"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
    static int SetUpdate(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <bool>(L, 2))
            {
                DG.Tweening.TweenParams obj = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
                bool arg0 = LuaDLL.lua_toboolean(L, 2);
                DG.Tweening.TweenParams o = obj.SetUpdate(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <DG.Tweening.UpdateType>(L, 2))
            {
                DG.Tweening.TweenParams obj  = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
                DG.Tweening.UpdateType  arg0 = (DG.Tweening.UpdateType)ToLua.ToObject(L, 2);
                DG.Tweening.TweenParams o    = obj.SetUpdate(arg0);
                ToLua.PushObject(L, o);
                return(1);
            }
            else if (count == 3)
            {
                DG.Tweening.TweenParams obj  = (DG.Tweening.TweenParams)ToLua.CheckObject <DG.Tweening.TweenParams>(L, 1);
                DG.Tweening.UpdateType  arg0 = (DG.Tweening.UpdateType)ToLua.CheckObject(L, 2, typeof(DG.Tweening.UpdateType));
                bool arg1 = LuaDLL.luaL_checkboolean(L, 3);
                DG.Tweening.TweenParams o = obj.SetUpdate(arg0, arg1);
                ToLua.PushObject(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.TweenParams.SetUpdate"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        static int _m_SetAs(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                DG.Tweening.Tweener gen_to_be_invoked = (DG.Tweening.Tweener)translator.FastGetCSObj(L, 1);


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <DG.Tweening.Tween>(L, 2))
                {
                    DG.Tweening.Tween _asTween = (DG.Tweening.Tween)translator.GetObject(L, 2, typeof(DG.Tweening.Tween));

                    DG.Tweening.Tween gen_ret = gen_to_be_invoked.SetAs(_asTween);
                    translator.Push(L, gen_ret);



                    return(1);
                }
                if (gen_param_count == 2 && translator.Assignable <DG.Tweening.TweenParams>(L, 2))
                {
                    DG.Tweening.TweenParams _tweenParams = (DG.Tweening.TweenParams)translator.GetObject(L, 2, typeof(DG.Tweening.TweenParams));

                    DG.Tweening.Tween gen_ret = gen_to_be_invoked.SetAs(_tweenParams);
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to DG.Tweening.Tweener.SetAs!"));
        }
    static int _CreateDG_Tweening_TweenParams(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                DG.Tweening.TweenParams obj = new DG.Tweening.TweenParams();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: DG.Tweening.TweenParams.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#21
0
	void Start()
	{
		return;

		Vector3[] path = new[] {
			new Vector3(0,1,0),
			new Vector3(1,2,0),
			new Vector3(2,1,0),
			new Vector3(2,0,0)
		};

		TweenParams tp = new TweenParams()
			.SetEase(ease)
			.SetLoops(-1, loopType);

		AxisConstraint lockRotation = lockRotation0 | lockRotation1;

		// Relative VS non relative
		controller = targets[0].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[1].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(targets[2], forward)
			.SetAs(tp)
			.Pause();

		// Linear VS curved
		targets[2].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(new Vector3(3, 0, 0), forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[3].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();

		// Linear VS curved no lookAt
		targets[4].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[5].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetAs(tp)
			.SetRelative()
			.Pause();

		// Linear VS curved top-down
		path = new[] {
			new Vector3(0,0,1),
			new Vector3(1,0,2),
			new Vector3(2,0,1),
			new Vector3(2,0,0)
		};
		targets[6].DOPath(path, 3, PathType.CatmullRom, pathMode, pathResolution, pathsColors[0])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();
		targets[7].DOPath(path, 3, PathType.Linear, pathMode, pathResolution, pathsColors[1])
			.SetOptions(closePaths, lockPosition, lockRotation)
			.SetLookAt(0.1f, forward)
			.SetAs(tp)
			.SetRelative()
			.Pause();

		// Log lengths
		controller.ForceInit();
		Debug.Log("Controller path length: " + controller.PathLength());
	}
示例#22
0
 /// <summary>Sets the ease of the tween using a custom ease function.
 /// <para>If applied to Sequences eases the whole sequence animation</para></summary>
 public static TweenParams SetEase(this TweenParams tweenParams, CustomEase customEase)
 {
     customEase.ApplyTo(tweenParams);
     return(tweenParams);
 }
示例#23
0
        //creates a new tween with given arguments that moves along the path
        private void CreateTween()
        {
            //prepare DOTween's parameters, you can look them up here
            //http://dotween.demigiant.com/documentation.php

            TweenParams parms = new TweenParams();
            //differ between speed or time based tweening
            if (timeValue == TimeValue.speed)
                parms.SetSpeedBased();
            if (loopType == LoopType.yoyo)
                parms.SetLoops(-1, DG.Tweening.LoopType.Yoyo);

            //apply ease type or animation curve
            if (easeType == DG.Tweening.Ease.INTERNAL_Custom)
                parms.SetEase(animEaseType);
            else
                parms.SetEase(easeType);

            if (moveToPath)
                parms.OnWaypointChange(OnWaypointReached);
            else
            {
                if (loopType == LoopType.yoyo)
                    parms.OnStepComplete(ReachedEnd);

                transform.position = wpPos[0];

                parms.OnWaypointChange(OnWaypointChange);
                parms.OnComplete(ReachedEnd);
            }

            tween = transform.DOPath(wpPos, originSpeed, pathType, pathMode, 1)
                             .SetAs(parms)
                             .SetOptions(false, lockPosition, lockRotation)
                             .SetLookAt(lookAhead);

            if (!moveToPath && startPoint > 0)
            {
                GoToWaypoint(startPoint);
                startPoint = 0;
            }

            //continue new tween with adjusted speed if it was changed before
            if (originSpeed != speed)
                ChangeSpeed(speed);
        }
    public void Awake()
    {
        this.rectTransform = GetComponent<RectTransform>();

        // Cache default anim values
        this.titlePanelHeight = this.rectTransform.anchoredPosition.y;
        this.pivotY = this.rectTransform.pivot.y;
        this.drawZoneY = this.drawZone.transform.position.y;

        // Set anim settings
        this.slideAnimParams = new TweenParams().SetEase(Ease.InOutExpo);

        // Set sound button parent reference
        this.soundButton.ParentView = this;
    }
示例#25
0
 public DG.Tweening.Tween SetAs(DG.Tweening.TweenParams arg1)
 {
     return(default(DG.Tweening.Tween));
 }
示例#26
0
	void Start()
	{
		DOTween.logBehaviour = LogBehaviour.ErrorsOnly;

		txtInfo.text = txtInfo.text.Replace("#N", loops.ToString("N0"));

		// Set RectOffset since it can't be set before
		rectOffsetToTween = new RectOffset(0, 0, 0, 0);

		TweenParams tp = new TweenParams();
		tp.SetLoops(loops, loopType).SetAutoKill(false);
		if (ease == Ease.INTERNAL_Custom) tp.SetEase(easeCurve);
		else tp.SetEase(ease);

		// Transform tweens
		tweens = new Tween[targets.Length - 1];
		for (int i = 0; i < targets.Length; ++i)
		{
			Transform t = targets[i];
			switch (i) {
			case 0:
				tweens[i] = DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 5f, 0), 1.5f).SetAs(tp).SetRelative().SetUpdate(true).SetAutoKill(true);
				break;
			case 1:
				// Red cube (rotation)
				tweens[i] = DOTween.To(()=> t.rotation, x=> t.rotation = x, toRotation, 1.5f).SetAs(tp).SetRelative();
				break;
			case 2:
				tweens[i] = DOTween.To(()=> t.position, x=> t.position = x, new Vector3(0, 5f, 0), 1.5f).SetAs(tp).SetOptions(true).SetRelative().SetAutoKill(true);
				break;
			case 3:
				// Vector3Array (not stored)
				Vector3[] path = new[] {
					new Vector3(1,0,0), new Vector3(0,1,0), new Vector3(1,0,0), new Vector3(0,-1,0)
				};
				float[] durations = new[] { 0.5f, 0.5f, 0.5f, 0.5f };
				DOTween.ToArray(() => t.position, x => t.position = x, path, durations)
					.SetAs(tp).SetRelative().Pause();
				continue;
			}
			Tween tween = tweens[i];
			tween.OnStart(()=> Debug.Log("OnStart: " + t.name))
				.OnPlay(()=> Debug.Log("OnPlay: " + t.name))
				.OnPause(()=> Debug.Log("OnPause: " + t.name))
				.OnComplete(()=> Debug.Log("OnComplete: " + t.name))
				.Pause();
			switch (i) {
			case 0:
				tween.SetId(intId);
				// tween.OnStart(()=>tweens[2].Kill());
				break;
			case 1:
				tween.SetId(stringId);
				break;
			case 2:
				tween.SetId(this);
				break;
			}
		}
		// Additional tweens //////////////////////////
		// Float
		DOTween.To(()=> floatToTween, x=> floatToTween = x, 100, 1.5f).SetAs(tp).Pause();
		// Int
		DOTween.To(()=> intToTween, x=> intToTween = x, 100, 1.5f).SetAs(tp).Pause();
		// Uint
		DOTween.To(()=> uintToTween, x=> uintToTween = x, 50, 1.5f).SetAs(tp).Pause();
		// Vector2
		DOTween.To(()=> vector2toTween, x=> vector2toTween = x, new Vector2(50,100), 1.5f).SetAs(tp).Pause();
		// Vector4
		DOTween.To(()=> vector4toTween, x=> vector4toTween = x, new Vector4(50,100,150,200), 1.5f).SetAs(tp).Pause();
		// Rect
		DOTween.To(()=> rectToTween, x=> rectToTween = x, new Rect(10, 20, 50, 100), 1.5f).SetAs(tp).Pause();
		// RectOffset
		DOTween.To(()=> rectOffsetToTween, x=> rectOffsetToTween = x, new RectOffset(10, 20, 50, 100), 1.5f).SetAs(tp).Pause();
		// Color
		DOTween.To(()=> guiTexColor.color, x=> guiTexColor.color = x, Color.green, 1.5f).SetAs(tp).Pause();
		// Alpha
		DOTween.ToAlpha(()=> guiTexAlpha.color, x=> guiTexAlpha.color = x, 0f, 1.5f).SetAs(tp).Pause();
		// String
		DOTween.To(()=> stringToTween0, x=> stringToTween0 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).Pause();
		// String
		DOTween.To(()=> stringToTween1, x=> stringToTween1 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).Pause();
		// String (relative)
		DOTween.To(()=> stringToTween2, x=> stringToTween2 = x, "Hello I'm a new string!", 1.5f).SetAs(tp).SetRelative().Pause();
		if (tweenLightAndCam) {
			// Camera
			Camera.main.DOColor(toCamColor, 1.5f).SetAs(tp).Pause();
			// Light
			mainLight.DOColor(toLightColor, 1.5f).SetAs(tp).Pause();
			mainLight.DOIntensity(4, 1.5f).SetAs(tp).Pause();
		}
		// SpriteRenderer
		spriteRenderer.DOColor(toSpriteColor, 1.5f).SetAs(tp).Pause();
		// Specular material tween
		specularSphere.renderer.material.DOColor(Color.green, "_SpecColor", 1.5f).SetAs(tp).Pause();
		// Rotate towards
		targetToDoLookAt.DOLookAt(specularSphere.transform.position, 1.5f).SetAs(tp).Pause();
		targetToDoLookFrom.DOLookAt(specularSphere.transform.position, 1.5f).From().SetAs(tp).Pause();
	}