//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); } }
private static int OnWaypointChange(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); TweenParams tweenParams = (TweenParams)ToLua.CheckObject(L, 1, typeof(TweenParams)); LuaTypes luaTypes = LuaDLL.lua_type(L, 2); TweenCallback <int> action; if (luaTypes != LuaTypes.LUA_TFUNCTION) { action = (TweenCallback <int>)ToLua.CheckObject(L, 2, typeof(TweenCallback <int>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); action = (DelegateFactory.CreateDelegate(typeof(TweenCallback <int>), func) as TweenCallback <int>); } TweenParams o = tweenParams.OnWaypointChange(action); ToLua.PushObject(L, o); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
//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.Unset) { parms.SetEase(animEaseType); } else { parms.SetEase(easeType); } if (moveToPath) { parms.OnWaypointChange(OnWaypointReached); } else { //on looptype random initialize random order of waypoints if (loopType == LoopType.random) { RandomizeWaypoints(); } else if (loopType == LoopType.yoyo) { parms.OnStepComplete(ReachedEnd); } Vector3 startPos = wpPos[0]; if (local) { startPos = pathContainer.transform.TransformPoint(startPos); } transform.position = startPos; parms.OnWaypointChange(OnWaypointChange); parms.OnComplete(ReachedEnd); } if (pathMode == DG.Tweening.PathMode.Ignore && waypointRotation != RotationType.none) { if (rotationTarget == null) { rotationTarget = transform; } parms.OnUpdate(OnWaypointRotation); } if (local) { tween = transform.DOLocalPath(wpPos, originSpeed, pathType, pathMode) .SetAs(parms) .SetOptions(closeLoop, lockPosition, lockRotation) .SetLookAt(lookAhead); } else { tween = transform.DOPath(wpPos, originSpeed, pathType, pathMode) .SetAs(parms) .SetOptions(closeLoop, 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); } }
// Token: 0x06000749 RID: 1865 RVA: 0x00030738 File Offset: 0x0002EB38 private void CreateTween() { TweenParams tweenParams = new TweenParams(); if (this.timeValue == splineMove.TimeValue.speed) { tweenParams.SetSpeedBased(true); } if (this.loopType == splineMove.LoopType.yoyo) { tweenParams.SetLoops(-1, new DG.Tweening.LoopType?(DG.Tweening.LoopType.Yoyo)); } if (this.easeType == Ease.INTERNAL_Custom) { tweenParams.SetEase(this.animEaseType); } else { tweenParams.SetEase(this.easeType, null, null); } if (this.moveToPath) { tweenParams.OnWaypointChange(new TweenCallback <int>(this.OnWaypointReached)); } else { if (this.loopType == splineMove.LoopType.random) { this.RandomizeWaypoints(); } else if (this.loopType == splineMove.LoopType.yoyo) { tweenParams.OnStepComplete(new TweenCallback(this.ReachedEnd)); } Vector3 position = this.wpPos[0]; if (this.local) { position = this.pathContainer.transform.TransformPoint(position); } base.transform.position = position; tweenParams.OnWaypointChange(new TweenCallback <int>(this.OnWaypointChange)); tweenParams.OnComplete(new TweenCallback(this.ReachedEnd)); } if (this.local) { this.tween = base.transform.DOLocalPath(this.wpPos, this.originSpeed, this.pathType, this.pathMode, 10, null).SetAs(tweenParams).SetOptions(this.closeLoop, this.lockPosition, this.lockRotation).SetLookAt(this.lookAhead, null, null); } else { this.tween = base.transform.DOPath(this.wpPos, this.originSpeed, this.pathType, this.pathMode, 10, null).SetAs(tweenParams).SetOptions(this.closeLoop, this.lockPosition, this.lockRotation).SetLookAt(this.lookAhead, null, null); } if (!this.moveToPath && this.startPoint > 0) { this.GoToWaypoint(this.startPoint); this.startPoint = 0; } if (this.originSpeed != this.speed) { this.ChangeSpeed(this.speed); } }