Ejemplo n.º 1
0
    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();
        }
    }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
 public Tweener(GameObject gameObject, TweenOptions tweenOptions,
                TweenCompleteDelegate TweenComplete = null, TweenCancelledDelegate TweenCancelled = null)
 {
     this.gameObject     = gameObject;
     this.tweenOptions   = tweenOptions;
     this.TweenComplete  = TweenComplete;
     this.TweenCancelled = TweenCancelled;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
    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
    }