diff options
Diffstat (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs')
-rw-r--r-- | Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs index 69b91f7..533fbc8 100644 --- a/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs +++ b/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs @@ -2,18 +2,24 @@ using System.Collections.Generic; using UnityEngine; using UnityEditor; + namespace TweenAnimation { public class PlaybackTimer { - // 考虑了Pause的playback时间,没考虑playback limit + // 动画 + private TweenAnimation m_Animation; + + // 考虑了Pause的playback逻辑时间,考虑了playbackLimit public float time { get { + float t = realTime; if (m_PauseRealTime != -1) - return m_PauseRealTime - m_StartRealTime; - return realTime; + t = m_PauseRealTime - m_StartRealTime; + t = m_Animation.ApplyLimit(t); + return t; } } @@ -30,8 +36,9 @@ namespace TweenAnimation private float m_PauseRealTime; - public PlaybackTimer() + public PlaybackTimer(TweenAnimation animation) { + m_Animation = animation; Reset(); } @@ -48,6 +55,8 @@ namespace TweenAnimation public void Pause() { m_PauseRealTime = (float)EditorApplication.timeSinceStartup; + float t = m_Animation.ApplyLimit(m_PauseRealTime - m_StartRealTime); + m_PauseRealTime = m_StartRealTime + t; } public void Stop() |