public addTweenProperty ( AbstractTweenProperty, tweenProp ) : GoTweenConfig, | ||
tweenProp | AbstractTweenProperty, | |
리턴 | GoTweenConfig, |
public static GoTween MakeTween( Transform TheTransform, Vector3 Position, Quaternion Rotation, float MoveTime = 0.5f, bool IsLocal = false, GoEaseType Ease = GoEaseType.Linear, VoidDelegate OnCompleteFunction = null ) { GoTweenConfig Config = new GoTweenConfig(); Config.addTweenProperty(new PositionTweenProperty(Position, false, IsLocal)); //Config.addTweenProperty(new EulerAnglesTweenProperty(Rotation, false, IsLocal)); Config.addTweenProperty(new RotationQuaternionTweenProperty(Rotation, false, IsLocal)); Config.setEaseType(Ease); if(OnCompleteFunction != null){ Config.onComplete(c => { OnCompleteFunction(); }); } GoTween NewTween = new GoTween(TheTransform, MoveTime, Config); Go.addTween(NewTween); return NewTween; }
public void Event() { if(firstRun) { firstRun = false; spline = new GoSpline(eventPath); var pathProperty = new PositionPathTweenProperty(spline); var config = new GoTweenConfig(); config.addTweenProperty(pathProperty); var tween = new GoTween(PoPCamera.instance.transform, pathLength, config); Go.addTween(tween); if(multipleTargets) { focusTimer = focusPoints[0].time; } } if(multipleTargets) { if(focusTimer >= focusPoints[focusIndex].time && focusIndex != focusPoints.Count - 1) { focusIndex++; } Quaternion rotation = Quaternion.LookRotation(focusPoints[focusIndex].focus - PoPCamera.instance.transform.position); PoPCamera.instance.transform.rotation = Quaternion.Slerp(PoPCamera.instance.transform.rotation, rotation, 0.4f); } else { Quaternion rotation = Quaternion.LookRotation(singleTargetPos - PoPCamera.instance.transform.position); PoPCamera.instance.transform.rotation = Quaternion.Slerp(PoPCamera.instance.transform.rotation, rotation, 0.4f); } if(pathLength < 0) { PoPCamera.State = Camera_2.CameraState.Normal; Destroy(this.gameObject); } else pathLength -= Time.deltaTime; }
public void GoTo(Coord c) { if (_clickAnimationing) { return; } _clickAnimationing = true; Vector3 prePos = MapCamera.transform.localPosition; Vector3 lookPos = prePos + (Layout.HexCenter(c) - Layout.ScreenPos2WorldPos(MapCamera, MapInfoHighlightPos)); GoTweenConfig config = new GoTweenConfig(); FloatCallbackTweenProterty ftpy = new FloatCallbackTweenProterty(0, 1, delegate(float obj) { MoveCamera(Vector3.Lerp(prePos, lookPos, obj)); }); config.addTweenProperty(ftpy); config.onCompleteHandler = delegate(AbstractGoTween go) { _clickAnimationing = false; //App.ProxyMgr.MapProxy.GetBlockDataFromServer(); }; Go.to(MapCamera.transform, 1f, config); }
public void DoClickOnTile(Coord c) { MapTileVO mt = GameFacade.GetProxy <MapProxy>().GetTile(c); _clickAnimationing = true; Vector3 prePos = MapCamera.transform.localPosition; Vector3 lookPos = prePos + (Layout.HexCenter(c) - Layout.ScreenPos2WorldPos(MapCamera, MapInfoHighlightPos)); GoTweenConfig config = new GoTweenConfig(); FloatCallbackTweenProterty ftpy = new FloatCallbackTweenProterty(0, 1, delegate(float obj) { MoveCamera(Vector3.Lerp(prePos, lookPos, obj)); }); config.addTweenProperty(ftpy); config.onCompleteHandler = delegate(AbstractGoTween go) { _clickAnimationing = false; }; ShowHighLight(Layout.HexCenter(c)); Go.to(MapCamera.transform, 0.5f, config); if (onClickHandler != null) { onClickHandler(c); } }
public void Grow() { if (tween != null) { tween.destroy(); } var scaleProperty = new ScaleTweenProperty(new Vector3(maxSize, maxSize, maxSize)); var config = new GoTweenConfig(); config.addTweenProperty(scaleProperty); tween = new GoTween(transform, growingSpeed, config); tween.setOnCompleteHandler(c => { StartExplosionEffect(); Invoke("Explode", timeToExplode); }); Go.addTween(tween); Go.to(transform, 5f, new GoTweenConfig() .eulerAngles(new Vector3(0, 0, 360)) .setEaseType(GoEaseType.Linear) .setIterations(-1, GoLoopType.RestartFromBeginning) ); }
public void Start() { SelectionController.Instance.OnSelectModeChange.AddListener(ModeChange); flashing = new GoTweenConfig(); flashing.addTweenProperty(new ColorTweenProperty("color", Color.red)); flashing.loopType = GoLoopType.PingPong; flashing.iterations = -1; }
public static void Start(Transform[] ts, Vector3[] to) { GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); for (int i = 0; i < ts.Length; ++i) { goConfig.clearProperties(); goConfig.addTweenProperty(new PositionTweenProperty(to[i])); Go.to(ts[i], 1, goConfig); } }
// set up the tweens used in health behavior protected void InitializeTweens() { // Tween configuration MaterialColorTweenProperty red = new MaterialColorTweenProperty(Color.red); GoTweenConfig rConfig = new GoTweenConfig(); rConfig.addTweenProperty(red); rConfig.setIterations(6); rConfig.loopType = GoLoopType.PingPong; // Make a tween to turn the gameObject red turnRed = new GoTween(this.gameObject, .5f, rConfig); }
public override void DoClickToAct() { RotationTweenProperty rotationProperty = new RotationTweenProperty (new Vector3 (0, -90, 0), true, true); GoTweenConfig config = new GoTweenConfig(); config.addTweenProperty( rotationProperty ); var tween = new GoTween( transform, openingTime, config, OnOpenComplete ); Go.addTween (tween); GetComponent<AudioSource>().PlayOneShot (doorOpenSound, doorOpenSoundVolume); }
public void TweenCameraTo(Vector3 newpos, float duration = 0.2f) { Vector3 prePos = MapCamera.transform.localPosition; GoTweenConfig config = new GoTweenConfig(); FloatCallbackTweenProterty ftpy = new FloatCallbackTweenProterty(0, 1, delegate(float obj) { MoveCamera(Vector3.Lerp(prePos, newpos, obj)); }); config.addTweenProperty(ftpy); Go.to(MapCamera.transform, duration, config); }
public override void DoClickToAct() { RotationTweenProperty rotationProperty = new RotationTweenProperty(new Vector3(0, -90, 0), true, true); GoTweenConfig config = new GoTweenConfig(); config.addTweenProperty(rotationProperty); var tween = new GoTween(transform, openingTime, config, OnOpenComplete); Go.addTween(tween); GetComponent <AudioSource>().PlayOneShot(doorOpenSound, doorOpenSoundVolume); }
static public int addTweenProperty(IntPtr l) { try { GoTweenConfig self = (GoTweenConfig)checkSelf(l); AbstractTweenProperty a1; checkType(l, 2, out a1); var ret = self.addTweenProperty(a1); pushValue(l, ret); return(1); } catch (Exception e) { return(error(l, e)); } }
// Update is called once per frame void Shrink() { var scaleProperty = new ScaleTweenProperty(new Vector3(0.1f, 0.1f, 0.1f)); //var rotateProperty = new EulerAnglesTweenProperty(new Vector3(0f,0f,360f)); var config = new GoTweenConfig(); //config.addTweenProperty(rotateProperty); config.addTweenProperty(scaleProperty); tween = new GoTween(transform, fadeSpeed, config); Go.addTween(tween); }
public void Event() { if (firstRun) { firstRun = false; spline = new GoSpline(eventPath); var pathProperty = new PositionPathTweenProperty(spline); var config = new GoTweenConfig(); config.addTweenProperty(pathProperty); var tween = new GoTween(PoPCamera.instance.transform, pathLength, config); Go.addTween(tween); if (multipleTargets) { focusTimer = focusPoints[0].time; } } if (multipleTargets) { if (focusTimer >= focusPoints[focusIndex].time && focusIndex != focusPoints.Count - 1) { focusIndex++; } Quaternion rotation = Quaternion.LookRotation(focusPoints[focusIndex].focus - PoPCamera.instance.transform.position); PoPCamera.instance.transform.rotation = Quaternion.Slerp(PoPCamera.instance.transform.rotation, rotation, 0.4f); } else { Quaternion rotation = Quaternion.LookRotation(singleTargetPos - PoPCamera.instance.transform.position); PoPCamera.instance.transform.rotation = Quaternion.Slerp(PoPCamera.instance.transform.rotation, rotation, 0.4f); } if (pathLength < 0) { PoPCamera.State = Camera_2.CameraState.Normal; Destroy(this.gameObject); } else { pathLength -= Time.deltaTime; } }
void SetupShowMainTableTweens() { Go.defaultEaseType = GoEaseType.AnimationCurve; var overworldCameraPositionProperty = new PositionTweenProperty(overworldCameraTweenEndPosition, false, true); var overworldCameraTweenConfig = new GoTweenConfig(); overworldCameraTweenConfig.addTweenProperty(overworldCameraPositionProperty); overworldCameraTweenConfig.startPaused(); overworldCameraTweenConfig.easeCurve = showMainTableTweenCurve; overworldCameraTweenConfig.onCompleteHandler = OnOverworldCameraTweenComplete; overworldCameraTween = new GoTween(overworldCameraTransform, showMainTableTweenTime, overworldCameraTweenConfig); overworldCameraTween.autoRemoveOnComplete = false; Go.addTween(overworldCameraTween); var directionalLightRotationProperty = new RotationTweenProperty(directionalLightTweenEndRotation); var directionalLightTweenConfig = new GoTweenConfig(); directionalLightTweenConfig.addTweenProperty(directionalLightRotationProperty); directionalLightTweenConfig.startPaused(); directionalLightTweenConfig.easeCurve = setSunTweenCurve; directionalLightTween = new GoTween(directionalLightTransform, setSunTweenTime, directionalLightTweenConfig); directionalLightTween.autoRemoveOnComplete = false; Go.addTween(directionalLightTween); }
public void Grow() { //HERE I GROW; if (growTween != null) { growTween.pause(); } finishScale += 0.01f; Vector3 newScale = new Vector3(finishScale, finishScale, transform.localScale.z); var scaleProperty = new ScaleTweenProperty(newScale); tweenConfig = new GoTweenConfig(); //config.setDelay( 1f ); tweenConfig.addTweenProperty(scaleProperty); growTween = new GoTween(transform, 1f, tweenConfig); Go.addTween(growTween); }
public static void Start(Transform[] ts, Vector3[] to) { GoTweenConfig goConfig = new GoTweenConfig().setEaseType(GoEaseType.QuadInOut).setIterations(-1, GoLoopType.PingPong); for (int i = 0; i < ts.Length; ++i) { goConfig.clearProperties(); goConfig.addTweenProperty(new PositionTweenProperty(to[i])); Go.to(ts[i], 1, goConfig); } }
public static GoTween MakeTweenScale( Transform TheTransform, Vector3 Scale, float MoveTime, bool IsLocal = false, GoEaseType Ease = GoEaseType.Linear, VoidDelegate OnCompleteFunction = null ) { GoTweenConfig Config = new GoTweenConfig(); Config.addTweenProperty(new ScaleTweenProperty(Scale, false)); Config.setEaseType(Ease); if(OnCompleteFunction != null){ Config.onComplete(c => { OnCompleteFunction(); }); } GoTween NewTween = new GoTween(TheTransform, MoveTime, Config); Go.addTween(NewTween); return NewTween; }
void SetupTweens() { // Ease DG.Tweening.Ease dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad; Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad; LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad; GoEaseType goEase = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut; iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad; // Loop int loops = testSetup == TestSetup.Emit ? 1 : -1; DG.Tweening.LoopType dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart; Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart; LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp; GoLoopType goLoopType = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning; iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop; // Create tweens switch (testType) { case TestType.Floats: for (int i = 0; i < numTweens; ++i) { TestObjectData data = testObjsData[i]; switch (engine) { case Engine.HOTween: HOTween.To(data, duration, new Holoville.HOTween.TweenParms() .Prop("floatValue", rndFloats[i]) .Ease(hotweenEase) .Loops(loops, hotweenLoopType) ); break; case Engine.LeanTween: LeanTween.value(this.gameObject, x => data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); break; case Engine.GoKit: Go.to(data, duration, new GoTweenConfig() .floatProp("floatValueProperty", rndFloats[i]) .setEaseType(goEase) .setIterations(loops, goLoopType) ); break; case Engine.iTween: Hashtable hs = new Hashtable(); hs.Add("from", data.floatValue); hs.Add("to", rndFloats[i]); hs.Add("time", duration); hs.Add("onupdate", "UpdateiTweenFloat"); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.ValueTo(this.gameObject, hs); break; default: // tCopy is needed to create correct closure object, // otherwise closure will pass the same t to all the loop TestObjectData dataCopy = data; DOTween.To(() => dataCopy.floatValue, x => dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); break; } } break; default: for (int i = 0; i < numTweens; ++i) { float twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration; Transform t = testObjsTrans[i]; GameObject go = testObjsGos[i]; // Used by LeanTween and iTween switch (engine) { case Engine.HOTween: Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms() .Ease(hotweenEase) .Loops(loops, hotweenLoopType); if (positionTween) { Vector3 toPos = rndPositions[i]; tp.Prop("position", toPos); if (testSetup == TestSetup.Emit) { tp.OnComplete(() => EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase)); } } if (rotationTween) { Vector3 toRot = rndRotations[i]; tp.Prop("rotation", toRot); if (testSetup == TestSetup.Emit) { tp.OnComplete(() => EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase)); } } if (scaleTween) { tp.Prop("localScale", rndScale); if (testSetup == TestSetup.Emit) { tp.OnComplete(() => EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase)); } } HOTween.To(t, twDuration, tp); break; case Engine.LeanTween: LTDescr leanTween; if (positionTween) { Vector3 toPos = rndPositions[i]; leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); if (testSetup == TestSetup.Emit) { leanTween.setOnComplete(() => EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase)); } } if (rotationTween) { Vector3 toRot = rndRotations[i]; leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); if (testSetup == TestSetup.Emit) { leanTween.setOnComplete(() => EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase)); } } if (scaleTween) { leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); if (testSetup == TestSetup.Emit) { leanTween.setOnComplete(() => EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase)); } } break; case Engine.GoKit: GoTweenConfig goConfig = new GoTweenConfig() .setEaseType(goEase) .setIterations(loops, goLoopType); if (positionTween) { Vector3 toPos = rndPositions[i]; goConfig.addTweenProperty(new PositionTweenProperty(toPos)); if (testSetup == TestSetup.Emit) { goConfig.onComplete(x => EmitGoKitPositionFor(t, toPos, twDuration, goEase)); } } if (rotationTween) { Vector3 toRot = rndRotations[i]; goConfig.addTweenProperty(new RotationTweenProperty(toRot)); if (testSetup == TestSetup.Emit) { goConfig.onComplete(x => EmitGoKitRotationFor(t, toRot, twDuration, goEase)); } } if (scaleTween) { goConfig.addTweenProperty(new ScaleTweenProperty(rndScale)); if (testSetup == TestSetup.Emit) { goConfig.onComplete(x => EmitGoKitScaleFor(t, rndScale, twDuration, goEase)); } } Go.to(t, twDuration, goConfig); break; case Engine.iTween: Hashtable hs; if (positionTween) { hs = new Hashtable(); hs.Add("position", rndPositions[i]); hs.Add("time", twDuration); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.MoveTo(go, hs); } if (rotationTween) { hs = new Hashtable(); hs.Add("rotation", rndRotations[i]); hs.Add("time", twDuration); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.RotateTo(go, hs); } if (scaleTween) { hs = new Hashtable(); hs.Add("scale", rndScale); hs.Add("time", twDuration); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.ScaleTo(go, hs); } break; default: // tCopy is needed to create correct closure object, // otherwise closure will pass the same t to all the loop Transform tCopy = t; DG.Tweening.Tween dotween; if (positionTween) { Vector3 toPos = rndPositions[i]; dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); if (testSetup == TestSetup.Emit) { dotween.OnComplete(() => EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase)); } } if (rotationTween) { Vector3 toRot = rndRotations[i]; dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); if (testSetup == TestSetup.Emit) { dotween.OnComplete(() => EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase)); } } if (scaleTween) { dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); if (testSetup == TestSetup.Emit) { dotween.OnComplete(() => EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase)); } } break; } } break; } }
void SetupTweens() { // Ease DG.Tweening.Ease dotweenEase = easing == Easing.Linear ? DG.Tweening.Ease.Linear : DG.Tweening.Ease.InOutQuad; Holoville.HOTween.EaseType hotweenEase = easing == Easing.Linear ? Holoville.HOTween.EaseType.Linear : Holoville.HOTween.EaseType.EaseInOutQuad; LeanTweenType leanEase = easing == Easing.Linear ? LeanTweenType.linear : LeanTweenType.easeInOutQuad; GoEaseType goEase = easing == Easing.Linear ? GoEaseType.Linear : GoEaseType.QuadInOut; iTween.EaseType iTweenEase = easing == Easing.Linear ? iTween.EaseType.linear : iTween.EaseType.easeInOutQuad; // Loop int loops = testSetup == TestSetup.Emit ? 1 : -1; DG.Tweening.LoopType dotweenLoopType = testSetup == TestSetup.YoyoLoop ? DG.Tweening.LoopType.Yoyo : DG.Tweening.LoopType.Restart; Holoville.HOTween.LoopType hotweenLoopType = testSetup == TestSetup.YoyoLoop ? Holoville.HOTween.LoopType.Yoyo : Holoville.HOTween.LoopType.Restart; LeanTweenType leanLoopType = testSetup == TestSetup.YoyoLoop ? LeanTweenType.pingPong : LeanTweenType.clamp; GoLoopType goLoopType = testSetup == TestSetup.YoyoLoop ? GoLoopType.PingPong : GoLoopType.RestartFromBeginning; iTween.LoopType iTweenLoopType = loops != -1 ? iTween.LoopType.none : testSetup == TestSetup.YoyoLoop ? iTween.LoopType.pingPong : iTween.LoopType.loop; // Create tweens switch (testType) { case TestType.Floats: for (int i = 0; i < numTweens; ++i) { TestObjectData data = testObjsData[i]; switch (engine) { case Engine.HOTween: HOTween.To(data, duration, new Holoville.HOTween.TweenParms() .Prop("floatValue", rndFloats[i]) .Ease(hotweenEase) .Loops(loops, hotweenLoopType) ); break; case Engine.LeanTween: LeanTween.value(this.gameObject, x=> data.floatValue = x, data.floatValue, rndFloats[i], duration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); break; case Engine.GoKit: Go.to(data, duration, new GoTweenConfig() .floatProp("floatValueProperty", rndFloats[i]) .setEaseType(goEase) .setIterations(loops, goLoopType) ); break; case Engine.iTween: Hashtable hs = new Hashtable(); hs.Add("from", data.floatValue); hs.Add("to", rndFloats[i]); hs.Add("time", duration); hs.Add("onupdate", "UpdateiTweenFloat"); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.ValueTo(this.gameObject, hs); break; default: // tCopy is needed to create correct closure object, // otherwise closure will pass the same t to all the loop TestObjectData dataCopy = data; DOTween.To(()=> dataCopy.floatValue, x=> dataCopy.floatValue = x, rndFloats[i], duration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); break; } } break; default: for (int i = 0; i < numTweens; ++i) { float twDuration = testSetup == TestSetup.Emit ? UnityEngine.Random.Range(0.25f, 1f) : duration; Transform t = testObjsTrans[i]; GameObject go = testObjsGos[i]; // Used by LeanTween and iTween switch (engine) { case Engine.HOTween: Holoville.HOTween.TweenParms tp = new Holoville.HOTween.TweenParms() .Ease(hotweenEase) .Loops(loops, hotweenLoopType); if (positionTween) { Vector3 toPos = rndPositions[i]; tp.Prop("position", toPos); if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenPositionFor(t, toPos, twDuration, hotweenEase)); } if (rotationTween) { Vector3 toRot = rndRotations[i]; tp.Prop("rotation", toRot); if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenRotationFor(t, toRot, twDuration, hotweenEase)); } if (scaleTween) { tp.Prop("localScale", rndScale); if (testSetup == TestSetup.Emit) tp.OnComplete(()=> EmitHOTweenScaleFor(t, rndScale, twDuration, hotweenEase)); } HOTween.To(t, twDuration, tp); break; case Engine.LeanTween: LTDescr leanTween; if (positionTween) { Vector3 toPos = rndPositions[i]; leanTween = LeanTween.move(go, rndPositions[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenPositionFor(t, go, toPos, twDuration, leanEase)); } if (rotationTween) { Vector3 toRot = rndRotations[i]; leanTween = LeanTween.rotate(go, rndRotations[i], twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenRotationFor(t, go, toRot, twDuration, leanEase)); } if (scaleTween) { leanTween = LeanTween.scale(go, rndScale, twDuration).setEase(leanEase).setRepeat(loops).setLoopType(leanLoopType); if (testSetup == TestSetup.Emit) leanTween.setOnComplete(()=> EmitLeanTweenScaleFor(t, go, rndScale, twDuration, leanEase)); } break; case Engine.GoKit: GoTweenConfig goConfig = new GoTweenConfig() .setEaseType(goEase) .setIterations(loops, goLoopType); if (positionTween) { Vector3 toPos = rndPositions[i]; goConfig.addTweenProperty(new PositionTweenProperty(toPos)); if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitPositionFor(t, toPos, twDuration, goEase)); } if (rotationTween) { Vector3 toRot = rndRotations[i]; goConfig.addTweenProperty(new RotationTweenProperty(toRot)); if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitRotationFor(t, toRot, twDuration, goEase)); } if (scaleTween) { goConfig.addTweenProperty(new ScaleTweenProperty(rndScale)); if (testSetup == TestSetup.Emit) goConfig.onComplete(x=> EmitGoKitScaleFor(t, rndScale, twDuration, goEase)); } Go.to(t, twDuration, goConfig); break; case Engine.iTween: Hashtable hs; if (positionTween) { hs = new Hashtable(); hs.Add("position", rndPositions[i]); hs.Add("time", twDuration); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.MoveTo(go, hs); } if (rotationTween) { hs = new Hashtable(); hs.Add("rotation", rndRotations[i]); hs.Add("time", twDuration); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.RotateTo(go, hs); } if (scaleTween) { hs = new Hashtable(); hs.Add("scale", rndScale); hs.Add("time", twDuration); hs.Add("looptype", iTweenLoopType); hs.Add("easetype", iTweenEase); iTween.ScaleTo(go, hs); } break; default: // tCopy is needed to create correct closure object, // otherwise closure will pass the same t to all the loop Transform tCopy = t; DG.Tweening.Tween dotween; if (positionTween) { Vector3 toPos = rndPositions[i]; dotween = tCopy.DOMove(toPos, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenPositionFor(t, toPos, twDuration, dotweenEase)); } if (rotationTween) { Vector3 toRot = rndRotations[i]; dotween = tCopy.DORotate(toRot, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenRotationFor(t, toRot, twDuration, dotweenEase)); } if (scaleTween) { dotween = tCopy.DOScale(rndScale, twDuration).SetEase(dotweenEase).SetLoops(loops, dotweenLoopType); if (testSetup == TestSetup.Emit) dotween.OnComplete(()=> EmitDOTweenScaleFor(t, rndScale, twDuration, dotweenEase)); } break; } } break; } }