public static void Trigger(float duration, Tweens.TweenCurve tween = Tweens.TweenCurve.LinearTween, int id = 0) { e._id = id; e._duration = duration; e._curve = tween; EventManager.TriggerEvent(e); }
/// <summary> /// Initializes a new instance of the <see cref="MoreMountains.MMInterface.MMFadeEvent"/> struct. /// </summary> /// <param name="duration">Duration, in seconds.</param> /// <param name="targetAlpha">Target alpha, from 0 to 1.</param> public FadeEvent(float duration, float targetAlpha, Tweens.TweenCurve tween = Tweens.TweenCurve.LinearTween, int id = 0) { _id = id; _duration = duration; _targetAlpha = targetAlpha; _curve = tween; }
protected virtual void StartFading(float initialAlpha, float endAlpha, float duration, Tweens.TweenCurve curve, int id) { if (id != _id) { return; } EnableFader(); _fading = true; _initialAlpha = initialAlpha; _currentTargetAlpha = endAlpha; _fadeStartedAt = _ignoreTimescale ? Time.unscaledTime : Time.time; _currentCurve = curve; _currentDuration = duration; }
/// <summary> /// Initializes a new instance of the <see cref="MoreMountains.MMInterface.MMFadeOutEvent"/> struct. /// </summary> /// <param name="duration">Duration.</param> public FadeOutEvent(float duration, Tweens.TweenCurve tween = Tweens.TweenCurve.LinearTween, int id = 0) { _id = id; _duration = duration; _curve = tween; }
protected static IEnumerator RotateTransformAroundCo(Transform targetTransform, Transform center, Transform destination, float angle, WaitForSeconds delay, float delayDuration, float duration, Tweens.TweenCurve curve) { if (delayDuration > 0f) { yield return(delay); } Vector3 initialRotationPosition = targetTransform.transform.position; Quaternion initialRotationRotation = targetTransform.transform.rotation; float rate = 1f / duration; float timeSpent = 0f; while (timeSpent < duration) { float newAngle = Tools.Tweens.Tween(timeSpent, 0f, duration, 0f, angle, curve); targetTransform.transform.position = initialRotationPosition; initialRotationRotation = targetTransform.transform.rotation; targetTransform.RotateAround(center.transform.position, center.transform.up, newAngle); targetTransform.transform.rotation = initialRotationRotation; timeSpent += Time.deltaTime; yield return(null); } targetTransform.transform.position = destination.position; }
public static Coroutine RotateTransformAround(MonoBehaviour mono, Transform targetTransform, Transform center, Transform destination, float angle, WaitForSeconds delay, float delayDuration, float duration, Tweens.TweenCurve curve) { return(mono.StartCoroutine(RotateTransformAroundCo(targetTransform, center, destination, angle, delay, delayDuration, duration, curve))); }
protected static IEnumerator MoveTransformCo(Transform targetTransform, Transform origin, Transform destination, WaitForSeconds delay, float delayDuration, float duration, Tweens.TweenCurve curve, bool updatePosition = true, bool updateRotation = true) { if (delayDuration > 0f) { yield return(delay); } float timeLeft = duration; while (timeLeft > 0f) { if (updatePosition) { targetTransform.transform.position = Tools.Tweens.Tween(duration - timeLeft, 0f, duration, origin.position, destination.position, curve); } if (updateRotation) { targetTransform.transform.rotation = Tools.Tweens.Tween(duration - timeLeft, 0f, duration, origin.rotation, destination.rotation, curve); } timeLeft -= Time.deltaTime; yield return(null); } if (updatePosition) { targetTransform.transform.position = destination.position; } if (updateRotation) { targetTransform.transform.localEulerAngles = destination.localEulerAngles; } }
public static Coroutine MoveTransform(MonoBehaviour mono, Transform targetTransform, Transform origin, Transform destination, WaitForSeconds delay, float delayDuration, float duration, Tweens.TweenCurve curve, bool updatePosition = true, bool updateRotation = true) { return(mono.StartCoroutine(MoveTransformCo(targetTransform, origin, destination, delay, delayDuration, duration, curve, updatePosition, updateRotation))); }