private IEnumerator doPositionTween(float goalPercent, float transitionTime, TweenCompleteDelegate onComplete = null) { //Debug.Log("doPositionTween: " + goalPercent); float startTime = Time.time; Vector3 from = transform.localPosition; Vector3 to = Vector3.Lerp(m_startPosition, m_wipeOutPosition, goalPercent); while ( true ) { float percentage = Mathf.Clamp01((Time.time - startTime)/transitionTime); //Debug.Log("Tween step: " + percentage); transform.localPosition = Vector3.Lerp(from, to, percentage); // Kick out of the loop if we're done if ( percentage == 1 ) { break; } else { // otherwise continue yield return 1; } } if ( onComplete != null ) { onComplete(); } }
private IEnumerator doPositionTween(float goalPercent, float transitionTime, TweenCompleteDelegate onComplete = null) { //Debug.Log("doPositionTween: " + goalPercent); float startTime = Time.time; Vector3 from = transform.localPosition; Vector3 to = Vector3.Lerp(m_startPosition, m_wipeOutPosition, goalPercent); while (true) { float percentage = Mathf.Clamp01((Time.time - startTime) / transitionTime); //Debug.Log("Tween step: " + percentage); transform.localPosition = Vector3.Lerp(from, to, percentage); // Kick out of the loop if we're done if (percentage == 1) { break; } else // otherwise continue { yield return(1); } } if (onComplete != null) { onComplete(); } }
public Tweener(GameObject gameObject, TweenOptions tweenOptions, TweenCompleteDelegate TweenComplete = null, TweenCancelledDelegate TweenCancelled = null) { this.gameObject = gameObject; this.tweenOptions = tweenOptions; this.TweenComplete = TweenComplete; this.TweenCancelled = TweenCancelled; }
public ClingyRotationTweener(GameObject gameObject, TweenOptions tweenOptions, RotateMethod rotateMethod, GetDestinationRotationDelegate GetDestinationRotation, TweenCompleteDelegate TweenComplete = null, TweenCancelledDelegate TweenCancelled = null) : base(gameObject, tweenOptions, TweenComplete, TweenCancelled) { this.rotateMethod = rotateMethod; this.GetDestinationRotation = GetDestinationRotation; }
public ClingyPositionTweener(GameObject gameObject, TweenOptions tweenOptions, MoveMethod moveMethod, GetDestinationPositionDelegate GetDestinationPosition, TweenCompleteDelegate TweenComplete = null, TweenCancelledDelegate TweenCancelled = null) : base(gameObject, tweenOptions, TweenComplete, TweenCancelled) { this.moveMethod = moveMethod; this.GetDestinationPosition = GetDestinationPosition; }
public static Tweener TweenRotation(GameObject gameObject, TweenOptions tweenOptions, RotateMethod rotateMethod, GetDestinationRotationDelegate GetDestinationRotation, TweenCompleteDelegate TweenComplete = null, TweenCancelledDelegate TweenCancelled = null) { Tweener tweener = new ClingyRotationTweener(gameObject, tweenOptions, rotateMethod, GetDestinationRotation, TweenComplete, TweenCancelled); tweener.Start(); return(tweener); }
private IEnumerator doPositionTween(float goalPercent, float transitionTime, TweenCompleteDelegate onComplete = null) { // Debug.Log("doPositionTween: " + goalPercent); float startTime = Time.time; Vector3 from = transform.localPosition; Vector3 to = Vector3.Lerp(m_startPosition, m_wipeOutPosition, goalPercent); while ( true ) { float fraction = Mathf.Clamp01((Time.time - startTime)/transitionTime); // Debug.Log("Tween step: " + fraction); transform.localPosition = Vector3.Lerp(from, to, fraction); if (m_cameraAlignment != null) m_cameraAlignment.tween = fraction; // Kick out of the loop if we're done if ( fraction == 1 ) { break; } else { // otherwise continue yield return 1; } } if (onComplete != null) { //added by Danni Completed_Status = 1; onComplete (); } else Completed_Status = 0; // added by Danni }