Esempio n. 1
0
    //LookAtTwoPoints专用
    public void LookToAnimation(bool bReverse, float time, iTween.EaseType eType = iTween.EaseType.linear, DelegateType.MovePathCallback onComplete = null)
    {
        if (elookAtType != ELookAtType.LookAtTwoPoints)
        {
            return;
        }

        Hashtable args = new Hashtable();

        args.Add("from", 0f);
        args.Add("to", 1f);
        args.Add("time", time);
        args.Add("easetype", eType);

        beginRotation = gameObject.transform.localRotation;
        if (!bReverse)
        {
            args.Add("onupdate", "LookToAnimationUpdate_ToPos2");
            args.Add("onupdatetarget", gameObject);
            finalRotation = Quaternion.LookRotation(posLookAt2 - posEnd);
        }
        else
        {
            args.Add("onupdate", "LookToAnimationUpdate");
            args.Add("onupdatetarget", gameObject);
            finalRotation = Quaternion.LookRotation(posLookAt1 - posBegin);
        }
        args.Add("oncomplete", "LookToAnimationComplete");
        args.Add("oncompletetarget", gameObject);
        args.Add("ignoretimescale", false);
        iTween.ValueTo(gameObject, args);
        onLookToComplete = onComplete;
        isDoingLookTo    = true;
    }
Esempio n. 2
0
    public void LookToAnimation(float time, iTween.EaseType eType = iTween.EaseType.linear, DelegateType.MovePathCallback onComplete = null)
    {
//         Hashtable args = new Hashtable();
//         args.Add("looktarget", targetPos);
//         args.Add("time", time);
//         args.Add("easetype", eType);
//         args.Add("oncomplete", "LookToAnimationComplete");
//         args.Add("oncompletetarget", gameObject);
//         iTween.LookTo(gameObject, args);

        Hashtable args = new Hashtable();

        args.Add("from", 0f);
        args.Add("to", 1f);
        args.Add("time", time);
        args.Add("easetype", eType);
        args.Add("onupdate", "LookToAnimationUpdate");
        args.Add("onupdatetarget", gameObject);
        args.Add("oncomplete", "LookToAnimationComplete");
        args.Add("oncompletetarget", gameObject);
        args.Add("ignoretimescale", false);
        iTween.ValueTo(gameObject, args);

        beginRotation    = gameObject.transform.localRotation;
        finalRotation    = Quaternion.LookRotation(posLookAt1 - posEnd);
        onLookToComplete = onComplete;
        isDoingLookTo    = true;
    }
Esempio n. 3
0
    public void CreatePathAnimation(float from, float to, float time, iTween.EaseType eType = iTween.EaseType.linear, DelegateType.MovePathCallback onComplete = null, DelegateType.MovePathCallback onUpdate = null)
    {
        if (to == from)
        {
            return;
        }

        Hashtable args = new Hashtable();

        args.Add("from", from);
        args.Add("to", to);
        args.Add("time", time);
        args.Add("easetype", eType);
        args.Add("onupdate", "AnimationOnUpdate");
        args.Add("onupdatetarget", gameObject);
        args.Add("oncomplete", "AnimationOnComplete");
        args.Add("oncompletetarget", gameObject);
        args.Add("ignoretimescale", false);
        iTween.ValueTo(gameObject, args);

        if (from <= 0.1f)
        {
            iLookAtPoint = 2;//ELookAtType.LookAtTwoPoints时才有用
        }
        else if (from >= 0.9f)
        {
            iLookAtPoint = 1;
        }

        onAnimationComplete = onComplete;
        onAnimationUpdate   = onUpdate;
    }
Esempio n. 4
0
    public void AnimationOnComplete()
    {
        if (enabled == false)
        {
            return;
        }

        if (onAnimationComplete != null)
        {
            onAnimationComplete(1f);
        }

        onAnimationComplete = null;
        onAnimationUpdate   = null;
        curAnimationValue   = 0f;
    }