/// <summary> /// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference /// (meaning tweens that were started from this target, or that had this target added as an Id) /// and returns the total number of tweens involved. /// </summary> public static int DOTogglePause(this AudioMixer target) { return(DOTween.TogglePause(target)); }
/// <summary>Tweens a 2D Toolkit TextMesh's dimensions to the given value. /// Also stores the TextMesh as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOScaleZ(this tk2dTextMesh target, float endValue, float duration) { return(DOTween.To(() => target.scale, x => target.scale = x, new Vector3(0, 0, endValue), duration) .SetOptions(AxisConstraint.Z) .SetTarget(target)); }
/// <summary>Tweens a 2D Toolkit Sprite's dimensions to the given value. /// Also stores the Sprite as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOScale(this tk2dBaseSprite target, Vector3 endValue, float duration) { return(DOTween.To(() => target.scale, x => target.scale = x, endValue, duration) .SetTarget(target)); }
public void DORestartById(string id) { _playCount = -1; DOTween.Restart(this.gameObject, id); }
/// <summary>Tweens a 2D Toolkit SlicedSprite's dimensions to the given value. /// Also stores the SlicedSprite as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOScaleDimensions(this tk2dSlicedSprite target, Vector2 endValue, float duration) { return(DOTween.To(() => target.dimensions, x => target.dimensions = x, endValue, duration) .SetTarget(target)); }
public void DOPlayForwardById(string id) { DOTween.PlayForward(this.gameObject, id); }
public void DORewindAndPlayNext() { _playCount = -1; DOTween.Rewind(this.gameObject); DOPlayNext(); }
public override void DOPlayBackwards() { DOTween.PlayBackwards(this.gameObject); }
public override void DOPlayForward() { DOTween.PlayForward(this.gameObject); }
/// <summary> /// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference /// (meaning tweens that were started from this target, or that had this target added as an Id) /// and returns the total number of tweens flipped. /// </summary> public static int DOFlip(this AudioMixer target) { return(DOTween.Flip(target)); }
// These methods are here so they can be called directly via Unity's UGUI event system public override void DOPlay() { DOTween.Play(this.gameObject); }
/// <summary> /// Kills all tweens that have this target as a reference /// (meaning tweens that were started from this target, or that had this target added as an Id) /// and returns the total number of tweens killed. /// </summary> /// <param name="complete">If TRUE completes the tween before killing it</param> public static int DOKill(this AudioMixer target, bool complete = false) { return(DOTween.Kill(target, complete)); }
/// <summary> /// Completes all tweens that have this target as a reference /// (meaning tweens that were started from this target, or that had this target added as an Id) /// and returns the total number of tweens completed /// (meaning the tweens that don't have infinite loops and were not already complete) /// </summary> /// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired, /// otherwise they will be ignored</param> public static int DOComplete(this AudioMixer target, bool withCallbacks = false) { return(DOTween.Complete(target, withCallbacks)); }
/// <summary>Tweens an AudioSource's pitch to the given value. /// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOPitch(this AudioSource target, float endValue, float duration) { return(DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration).SetTarget(target)); }
public void DOPlayBackwardsById(string id) { DOTween.PlayBackwards(this.gameObject, id); }
public override void DOPause() { DOTween.Pause(this.gameObject); }
public void DOPlayBackwardsAllById(string id) { DOTween.PlayBackwards(id); }
public override void DOTogglePause() { DOTween.TogglePause(this.gameObject); }
public void DOPlayForwardAllById(string id) { DOTween.PlayForward(id); }
public override void DOComplete() { DOTween.Complete(this.gameObject); }
public void DORewindAllById(string id) { _playCount = -1; DOTween.Rewind(id); }
public override void DOKill() { DOTween.Kill(this.gameObject); tween = null; }
public void DORestartAllById(string id) { _playCount = -1; DOTween.Restart(id); }
public void DOPlayById(string id) { DOTween.Play(this.gameObject, id); }
/// <summary>Tweens a SlicedSprite's dimensions to the given value. /// Also stores the SlicedSprite as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOScaleDimensionsY(this tk2dSlicedSprite target, float endValue, float duration) { return(DOTween.To(() => target.dimensions, x => target.dimensions = x, new Vector2(0, endValue), duration) .SetOptions(AxisConstraint.Y) .SetTarget(target)); }
public void DOPlayAllById(string id) { DOTween.Play(id); }
/// <summary>Tweens a 2D Toolkit TextMesh's alpha color to the given value. /// Also stores the TextMesh as the tween's target so it can be used for filtered operations</summary> /// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param> public static Tweener DOFade(this tk2dTextMesh target, float endValue, float duration) { return(DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration) .SetTarget(target)); }
public void DOPauseAllById(string id) { DOTween.Pause(id); }
void FixedUpdate() { if (!_isRolling) { return; } if (_currentNumberIndex < _maxCount && Time.time >= _startTime + _currentNumberIndex * _interval) { _currentNumberIndex += 1; } for (int i = 0; i < _currentNumberIndex; i++) { if (_restRollingTimes[i] < 0) { continue; } Text number1 = _numberList1[i]; Text number2 = _numberList2[i]; number1.rectTransform.SetAnchoredPosY(_originSize.y - (_originSize.y - (number1.rectTransform.anchoredPosition.y - Time.deltaTime * _speed)) % (2 * _originSize.y)); if (number1.rectTransform.anchoredPosition.y - Time.deltaTime * _speed <= -_originSize.y && _restRollingTimes[i] >= 0) { _restRollingTimes[i] -= 1; if (_restRollingTimes[i] < 0) { number1.transform.DOLocalMoveY(-_originSize.y, _bufferTime); var s = DOTween.Sequence(); s.Append(number2.transform.DOLocalMoveY(-_bufferLength, _bufferTime)).Append(number2.transform.DOLocalMoveY(0, _harmonicTime).SetEase(Ease.OutCubic)); continue; } number1.rectTransform.SetAnchoredPosY(number1.rectTransform.anchoredPosition.y + 2 * _originSize.y); number1.text = NextNumber(number2.text); } number2.rectTransform.SetAnchoredPosY(_originSize.y - (_originSize.y - (number2.rectTransform.anchoredPosition.y - Time.deltaTime * _speed)) % (2 * _originSize.y)); if (number2.rectTransform.anchoredPosition.y - Time.deltaTime * _speed <= -_originSize.y && _restRollingTimes[i] >= 0) { _restRollingTimes[i] -= 1; if (_restRollingTimes[i] < 0) { number2.transform.DOLocalMoveY(-_originSize.y, _bufferTime); var s = DOTween.Sequence(); s.Append(number1.transform.DOLocalMoveY(-_bufferLength, _bufferTime)).Append(number1.transform.DOLocalMoveY(0, _harmonicTime).SetEase(Ease.OutCubic)); continue; } number2.rectTransform.SetAnchoredPosY(number2.rectTransform.anchoredPosition.y + 2 * _originSize.y); number2.text = NextNumber(number1.text); } } if ((_maxCount > 1 && _restRollingTimes[_maxCount - 2] < 0 && _restRollingTimes[_maxCount - 1] < 0) || (_maxCount == 1 && _restRollingTimes[0] < 0)) { if (!_fromZero) { transform.DOLocalMoveX(_lengthDelta / 2, _tweakTime).SetEase(Ease.OutCubic); } onComplete?.Invoke(); _isRolling = false; } }
/// <summary> /// Smoothly rewinds all tweens that have this target as a reference /// (meaning tweens that were started from this target, or that had this target added as an Id) /// and returns the total number of tweens rewinded. /// </summary> public static int DOSmoothRewind(this AudioMixer target) { return(DOTween.SmoothRewind(target)); }