File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ public class TSTimeDef
1111 public object onCompleteParams = null ;
1212 public Action onComplete = null ;
1313
14+ protected bool paused = false ;
15+
16+ private float pausedTime ;
1417
1518 public float Progress
1619 {
@@ -28,8 +31,28 @@ public float Progress
2831 startTime = now - value * duration ;
2932 Update ( now ) ;
3033 }
31- }
32-
34+ }
35+
36+ public bool Paused
37+ {
38+ get { return paused ; }
39+ set
40+ {
41+ if ( paused != value )
42+ {
43+ paused = value ;
44+ if ( paused )
45+ {
46+ pausedTime = Time . realtimeSinceStartup ;
47+ }
48+ else
49+ {
50+ startTime = Time . realtimeSinceStartup - ( pausedTime - startTime ) ;
51+ }
52+ }
53+ }
54+ }
55+
3356 public TSTimeDef ( float duration )
3457 {
3558 startTime = Time . realtimeSinceStartup ;
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ public void Restart()
118118
119119 public override bool Update ( float time )
120120 {
121- if ( startTime + delay < time )
121+ if ( ! paused && startTime + delay < time )
122122 {
123123 int len = propertyNames . Count ;
124124 float timePassed ;
You can’t perform that action at this time.
0 commit comments