static public int RepeatCall(float timeInterval, RepeatCallAction callOnUpdate) { Action at = null; int id = 0; LTDescr descr = null; at = () => { if (!callOnUpdate()) { LeanTween.cancel(id); descr = null; at = null; } else { if (descr.loopCount <= 1) { descr.setLoopCount(int.MaxValue - 1); } } }; descr = LeanTween.delayedCall(timeInterval, at).setRepeat(int.MaxValue - 1); id = descr.id; return(id); }
protected virtual void ApplyAdditionalSettings(LTDescr tween) { tween.setDelay(animationSettings.Delay) .setIgnoreTimeScale(animationSettings.IgnoreTimeScale); if (animationSettings.Easing == LeanTweenType.animationCurve) { tween.setEase(animationSettings.AnimationCurve); } else { tween.setEase(animationSettings.Easing); } if (animationSettings.Loop) { tween.setLoopCount(animationSettings.Loops); tween.setLoopType(animationSettings.LoopType); } }
public void Show() { if (_target == null) { _target = gameObject; } switch (_animationType) { case UIAnimayionTypes.Move: Move(); break; case UIAnimayionTypes.Scale: Scale(); break; case UIAnimayionTypes.Rotate: Rotate(); break; case UIAnimayionTypes.Fade: Fade(); break; } _tweenObj.setDelay(_delay); _tweenObj.setEase(_easeType); if (_loop) { _tweenObj.setLoopCount(-1); } if (_pingPong) { _tweenObj.setLoopPingPong(); } _tweenObj.setOnComplete(() => _onComplete?.Invoke()); }
private void HandleTween() { if (_objectToAnimate == null) { _objectToAnimate = gameObject; } if (_objectToDisable == null) { _objectToDisable = gameObject; } switch (_animationType) { case AnimationType.MoveX: MoveX(); break; case AnimationType.MoveY: MoveY(); break; case AnimationType.Move: Move(); break; case AnimationType.MoveLocalX: MoveLocalX(); break; case AnimationType.MoveLocalY: MoveLocalY(); break; case AnimationType.MoveLocal: MoveLocal(); break; case AnimationType.RotateX: RotateX(); break; case AnimationType.RotateY: RotateY(); break; case AnimationType.RotateZ: RotateZ(); break; case AnimationType.Rotate: Rotate(); break; case AnimationType.RotateLocal: RotateLocal(); break; case AnimationType.ScaleX: ScaleX(); break; case AnimationType.ScaleY: ScaleY(); break; case AnimationType.ScaleZ: ScaleZ(); break; case AnimationType.Scale: Scale(); break; case AnimationType.Alpha: Fade(); break; case AnimationType.Color: Color(); break; } _tweenObject.setDelay(_delay); _tweenObject.setEase(_easeType); if (_loop) { _tweenObject.setLoopCount(int.MaxValue); } if (_pingPong) { _tweenObject.setLoopPingPong(); } }
private void HandleTween() { switch (animationType) { case AnimationType.MoveX: MoveX(); break; case AnimationType.MoveY: MoveY(); break; case AnimationType.Move: Move(); break; case AnimationType.MoveLocalX: MoveLocalX(); break; case AnimationType.MoveLocalY: MoveLocalY(); break; case AnimationType.MoveLocal: MoveLocal(); break; case AnimationType.RotateX: RotateX(); break; case AnimationType.RotateY: RotateY(); break; case AnimationType.RotateZ: RotateZ(); break; case AnimationType.Rotate: Rotate(); break; case AnimationType.RotateLocal: RotateLocal(); break; case AnimationType.ScaleX: ScaleX(); break; case AnimationType.ScaleY: ScaleY(); break; case AnimationType.ScaleZ: ScaleZ(); break; case AnimationType.Scale: Scale(); break; case AnimationType.Alpha: Fade(); break; case AnimationType.Color: Color(); break; } _tweenObject.setDelay(delay); _tweenObject.setEase(easeType); _tweenObject.setIgnoreTimeScale(useUnscaledTime); if (loop) { _tweenObject.setLoopCount(int.MaxValue); } if (pingPong) { _tweenObject.setLoopPingPong(); } }