public static Coroutine Tween(UnityAction <Vector4> onChange, Vector4 from, Vector4 to, float duration, AnimationCurve curve = null, bool ignoreTimeScale = false, UnityObject parent = null) { if (curve == null) { curve = defaultCurve; } return(CoroutineHolder.StartCoroutine(parent, TweenCustomRoute( onChange, from, to, duration, curve, ignoreTimeScale ))); }
public static Coroutine Tween(this Transform target, Transform from, Transform to, float duration, AnimationCurve curve = null, bool position = true, bool rotation = true, bool scale = true, bool ignoreTimeScale = false) { if (target == null) { throw new ArgumentNullException("target"); } if (to == null) { throw new ArgumentNullException("to"); } if (curve == null) { curve = defaultCurve; } Coroutine c; if (position && tPosDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } if (rotation && tRotDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } if (scale && tSclDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } c = CoroutineHolder.StartCoroutine(target, TweenRoute( target, from, to, duration, curve, position, rotation, scale, ignoreTimeScale )); if (position) { tPosDict[target] = c; } if (rotation) { tRotDict[target] = c; } if (scale) { tSclDict[target] = c; } return(c); }
/// <summary> /// Find and stop the coroutine in all created holder instances. /// </summary> /// <param name="route">The route that have to stop</param> /// <returns><c>true</c> if success find the coroutine and stops it.</returns> public static bool FindAndStopCoroutine(IEnumerator route) { if (route == null) { return(false); } var _holders = new CoroutineHolder[holders.Count]; holders.CopyTo(_holders); foreach (var holder in _holders) { if (holder != null && holder.StopCoroutine(route)) { return(true); } } return(false); }
public static Coroutine TweenRotation(this Transform target, Quaternion from, Quaternion to, float duration, AnimationCurve curve = null, bool ignoreTimeScale = false, bool local = false) { if (target == null) { throw new ArgumentNullException("target"); } if (curve == null) { curve = defaultCurve; } Coroutine c; if (tRotDict.TryGetValue(target, out c)) { CoroutineHolder.FindAndStopCoroutine(c); } c = CoroutineHolder.StartCoroutine(target, TweenRotationRoute( target, from, to, duration, curve, ignoreTimeScale, local )); tRotDict[target] = c; return(c); }
public static Coroutine SetInterval(this UnityObject source, float delay, UnityAction action) { return(CoroutineHolder.SetInterval(source, delay, action)); }
public static Coroutine Delay(this UnityObject source, float delay, UnityAction action) { return(CoroutineHolder.Delay(source, delay, action)); }