@@ -48,9 +48,9 @@ public class JCS_3DShakeEffect : JCS_UnityObject
48
48
[ SerializeField ]
49
49
private JCS_TransformType mTransformType = JCS_TransformType . POSITION ;
50
50
51
- [ Tooltip ( "Override the effect even the the effect is enabled already ." ) ]
51
+ [ Tooltip ( "Force the effect even when its already in the motion ." ) ]
52
52
[ SerializeField ]
53
- private bool mRepeatOverride = false ;
53
+ private bool mForce = false ;
54
54
55
55
[ Tooltip ( "How long it shakes." ) ]
56
56
[ SerializeField ]
@@ -101,7 +101,7 @@ public class JCS_3DShakeEffect : JCS_UnityObject
101
101
public bool Effect { get { return this . mEffect ; } set { this . mEffect = value ; } }
102
102
103
103
public JCS_TransformType TransformType { get { return this . mTransformType ; } set { this . mTransformType = value ; } }
104
- public bool RepeatOverride { get { return this . mRepeatOverride ; } set { this . mRepeatOverride = value ; } }
104
+ public bool Force { get { return this . mForce ; } set { this . mForce = value ; } }
105
105
public float ShakeTime { get { return this . mShakeTime ; } set { this . mShakeTime = value ; } }
106
106
public float ShakeMargin { get { return this . mShakeMargin ; } }
107
107
public float ShakeSteps { get { return this . mShakeSteps ; } set { this . mShakeSteps = value ; } }
@@ -139,22 +139,18 @@ private void Test()
139
139
}
140
140
#endif
141
141
142
- /// <summary>
143
- /// Do the shake with default shake time and shake margin.
144
- /// </summary>
145
- public void DoShake ( )
146
- {
147
- DoShake ( mShakeTime , mShakeMargin ) ;
148
- }
149
-
150
142
/// <summary>
151
143
/// Do the shake effect with time and margin.
152
144
/// </summary>
153
145
/// <param name="time"> time to do the shake. </param>
154
146
/// <param name="margin"> margin to do the shake. </param>
155
- public void DoShake ( float time , float margin )
147
+ public void DoShake ( )
156
148
{
157
- if ( ! mRepeatOverride )
149
+ DoShake ( mShakeTime , mShakeMargin , mForce ) ;
150
+ }
151
+ public void DoShake ( float time , float margin , bool force )
152
+ {
153
+ if ( ! force )
158
154
{
159
155
// if is doing the effect
160
156
if ( mEffect )
@@ -187,7 +183,17 @@ private void DoEffect()
187
183
188
184
mShakeDelta = Vector3 . zero ;
189
185
190
- mShakeTimer += JCS_Time . ItTime ( mTimeType ) ;
186
+ float dt = JCS_Time . ItTime ( mTimeType ) ;
187
+
188
+ // Handle pause situation.
189
+ {
190
+ var pm = JCS_PauseManager . instance ;
191
+
192
+ if ( pm != null && pm . Paused )
193
+ return ;
194
+ }
195
+
196
+ mShakeTimer += dt ;
191
197
192
198
if ( mShakeTimer < mShakeTime )
193
199
{
0 commit comments