Merged in rmruano/unity-ui-extensions/ScrollSnapTimeScale (pull request #42)

Allow ignoring the Time.timeScale on ScrollSnaps (Horiz + Vert)
pull/413/head
Rubén Moraleda 2019-01-15 17:28:41 +00:00 committed by Simon Jackson
commit 5fbf47671f
3 changed files with 8 additions and 5 deletions

View File

@ -35,7 +35,7 @@ namespace UnityEngine.UI.Extensions
} }
else if (_lerp) else if (_lerp)
{ {
_screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime); _screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * (UseTimeScale ? Time.deltaTime : Time.unscaledDeltaTime));
if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f) if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f)
{ {
_screensContainer.localPosition = _lerp_target; _screensContainer.localPosition = _lerp_target;
@ -292,4 +292,4 @@ namespace UnityEngine.UI.Extensions
} }
#endregion #endregion
} }
} }

View File

@ -76,6 +76,9 @@ namespace UnityEngine.UI.Extensions
[Tooltip("Speed at which the ScrollRect will keep scrolling before slowing down and stopping (optional)")] [Tooltip("Speed at which the ScrollRect will keep scrolling before slowing down and stopping (optional)")]
public int SwipeVelocityThreshold = 100; public int SwipeVelocityThreshold = 100;
[Tooltip("Use time scale instead of unscaled time (optional)")]
public Boolean UseTimeScale = true;
[Tooltip("The visible bounds area, controls which items are visible/enabled. *Note Should use a RectMask. (optional)")] [Tooltip("The visible bounds area, controls which items are visible/enabled. *Note Should use a RectMask. (optional)")]
public RectTransform MaskArea; public RectTransform MaskArea;
@ -592,4 +595,4 @@ namespace UnityEngine.UI.Extensions
} }
#endregion #endregion
} }
} }

View File

@ -35,7 +35,7 @@ namespace UnityEngine.UI.Extensions
} }
else if (_lerp) else if (_lerp)
{ {
_screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * Time.deltaTime); _screensContainer.localPosition = Vector3.Lerp(_screensContainer.localPosition, _lerp_target, transitionSpeed * (UseTimeScale ? Time.deltaTime : Time.unscaledDeltaTime));
if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f) if (Vector3.Distance(_screensContainer.localPosition, _lerp_target) < 0.1f)
{ {
_screensContainer.localPosition = _lerp_target; _screensContainer.localPosition = _lerp_target;
@ -291,4 +291,4 @@ namespace UnityEngine.UI.Extensions
} }
#endregion #endregion
} }
} }