summaryrefslogtreecommitdiff
path: root/Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-05-31 09:43:09 +0800
committerchai <chaifix@163.com>2021-05-31 09:43:09 +0800
commit2683c04adcaff44f9504248d2c983cd86bd4b3ad (patch)
tree1ab3e0ac80b3ace9a8cb1a1f897dbb73d2612d52 /Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs
parent293def05f43c55fce6e90d6b1907c9d9fc63facc (diff)
*tween
Diffstat (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs')
-rw-r--r--Assets/UI_Extension/Scripts/Animation/Tween/Editor/PlaybackTimer.cs17
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()