mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
If time is 0, now tween's won't be updated at all (unless they're timeScale independent)
This commit is contained in:
parent
3347210ee0
commit
186d408de0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,28 +6,38 @@ using UnityEngine.SceneManagement;
|
|||||||
|
|
||||||
public class TempPro : MonoBehaviour
|
public class TempPro : MonoBehaviour
|
||||||
{
|
{
|
||||||
public DOTweenPath target;
|
public Transform target;
|
||||||
|
public Vector3 damageShakeStrength = new Vector3( 0.4f, 0.2f, 0 );
|
||||||
|
public int damageShakeVibration = 7;
|
||||||
|
public float damageShakeRandomness = 15;
|
||||||
|
public float damageShakeDuration = 1.5f;
|
||||||
|
private Tweener screenShake;
|
||||||
|
|
||||||
IEnumerator Start()
|
private Vector3 original;
|
||||||
{
|
|
||||||
Tween t = this.transform.DOMoveX(2, 2).OnRewind(()=> Debug.Log("Rewind 0"));
|
|
||||||
yield return new WaitForSeconds(1);
|
|
||||||
t.Rewind();
|
|
||||||
// target.GetTween().Rewind();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
original = target.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(KeyCode.Space)) SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
if ( Input.GetKeyDown( KeyCode.K ) )
|
||||||
}
|
Time.timeScale = Time.timeScale < 1 ? Time.timeScale = 1 : 0;
|
||||||
|
|
||||||
public void OnComplete()
|
if ( Input.GetKeyDown( KeyCode.S ) )
|
||||||
{
|
{
|
||||||
Debug.Log("COMPLETE");
|
Vector3 shakeOffset = new Vector3();
|
||||||
}
|
screenShake = DOTween.Shake( () => shakeOffset, x => { shakeOffset = x; target.position += x; }, damageShakeDuration, damageShakeStrength, damageShakeVibration, damageShakeRandomness, false )
|
||||||
|
.SetUpdate( false );
|
||||||
public void OnRewind()
|
// screenShake = target.DOMoveX(10, damageShakeDuration);
|
||||||
{
|
// screenShake = target.DOShakePosition(damageShakeDuration, damageShakeStrength, damageShakeVibration, damageShakeRandomness, false);
|
||||||
Debug.Log("REWIND");
|
screenShake.OnComplete( () =>
|
||||||
|
{
|
||||||
|
screenShake = target.DOMove( original, 0.5f ).OnComplete( () => screenShake = null ).SetUpdate( false );
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -6,20 +6,29 @@ using DG.Tweening;
|
|||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Plugins.Options;
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class TempTests : BrainBase
|
public class TempTests : BrainBase
|
||||||
{
|
{
|
||||||
public RectTransform target;
|
public Transform target;
|
||||||
|
Sequence seq;
|
||||||
|
|
||||||
void Start()
|
private void Awake()
|
||||||
{
|
{
|
||||||
DOTween.Init();
|
// DOTween.Init();
|
||||||
}
|
//
|
||||||
|
// seq = DOTween.Sequence()
|
||||||
|
// .OnComplete(()=> Debug.Log("COMPLETE"));
|
||||||
|
// seq.AppendInterval(1);
|
||||||
|
// seq.Append(target.DOMoveX(5, 1).OnComplete(()=> Debug.Log("Tween 0 complete")));
|
||||||
|
// seq.AppendCallback(() => {
|
||||||
|
// Debug.Log("Callback fired");
|
||||||
|
// target.DOMoveX(-5, 1);
|
||||||
|
// });
|
||||||
|
|
||||||
public void Shake(float duration)
|
seq = DOTween.Sequence();
|
||||||
{
|
seq.AppendInterval(2)
|
||||||
target.DOShakeScale(duration, 0.15f, 10, 90f, true)
|
.Append(target.DOMoveX(100, 1))
|
||||||
.SetEase(Ease.InOutBack)
|
.AppendCallback(() => { target.DOMoveX(-50, 2); });
|
||||||
.Play();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@ -351,6 +351,7 @@ namespace DG.Tweening.Core
|
|||||||
if (!t.isPlaying) continue;
|
if (!t.isPlaying) continue;
|
||||||
t.creationLocked = true; // Lock tween creation methods from now on
|
t.creationLocked = true; // Lock tween creation methods from now on
|
||||||
float tDeltaTime = (t.isIndependentUpdate ? independentTime : deltaTime) * t.timeScale;
|
float tDeltaTime = (t.isIndependentUpdate ? independentTime : deltaTime) * t.timeScale;
|
||||||
|
if (tDeltaTime <= 0) continue; // Skip update in case time is 0
|
||||||
if (!t.delayComplete) {
|
if (!t.delayComplete) {
|
||||||
tDeltaTime = t.UpdateDelay(t.elapsedDelay + tDeltaTime);
|
tDeltaTime = t.UpdateDelay(t.elapsedDelay + tDeltaTime);
|
||||||
if (tDeltaTime <= -1) {
|
if (tDeltaTime <= -1) {
|
||||||
|
|||||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
|||||||
public class DOTween
|
public class DOTween
|
||||||
{
|
{
|
||||||
/// <summary>DOTween's version</summary>
|
/// <summary>DOTween's version</summary>
|
||||||
public static readonly string Version = "1.1.605";
|
public static readonly string Version = "1.1.610";
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user