reset() public method

public reset ( ) : void
return void
Beispiel #1
0
        private static void StopTween(LTDescr instance)
        {
            if (instance == null)
            {
                return;
            }

            LeanTween.cancel(instance.uniqueId);
            instance.reset();
        }
Beispiel #2
0
        private void ResetTween()
        {
            if (_spawnTween == null)
            {
                return;
            }

            StopMovement();

            LeanTween.cancel(_spawnTween.uniqueId);
            _spawnTween.reset();
            _spawnTween = null;
        }
Beispiel #3
0
    public static LTDescr options()
    {
        init();

        for(j=0, i = startSearch; j < maxTweens; i++){
        if(i>=maxTweens-1)
            i = 0;
        if(tweens[i].toggle==false){
            if(i+1>tweenMaxSearch)
                tweenMaxSearch = i+1;
            startSearch = i + 1;
            break;
        }

        j++;
        if(j>=maxTweens)
            return logError("LeanTween - You have run out of available spaces for tweening. To avoid this error increase the number of spaces to available for tweening when you initialize the LeanTween class ex: LeanTween.init( "+(maxTweens*2)+" );") as LTDescr;
        }
        tween = tweens[i];
        tween.reset();
        tween.setId( (uint)i );

        return tween;
    }
Beispiel #4
0
    private static int pushNewTween( GameObject gameObject, Vector3 to, float time, TweenAction tweenAction, Hashtable optional )
    {
        init(maxTweens);
        if(gameObject==null)
        return -1;

        j = 0;
        for(i = startSearch; j < maxTweens; i++){
        if(i>=maxTweens-1)
            i = 0;
        if(tweens[i].toggle==false){
            if(i+1>tweenMaxSearch)
                tweenMaxSearch = i+1;
            startSearch = i + 1;
            break;
        }

        j++;
        if(j>=maxTweens){
            logError("LeanTween - You have run out of available spaces for tweening. To avoid this error increase the number of spaces to available for tweening when you initialize the LeanTween class ex: LeanTween.init( "+(maxTweens*2)+" );");
            return -1;
        }
        }
        tween = tweens[i];
        tween.toggle = true;
        tween.reset();
        tween.trans = gameObject.transform;
        tween.to = to;
        tween.time = time;
        tween.type = tweenAction;
        tween.optional = optional;
        tween.setId( (uint)i );
        //tween.hasPhysics = gameObject.rigidbody!=null;

        if(optional!=null){
        var ease = optional["ease"];
        //LeanTweenType ease;
        var optionsNotUsed = 0;
        if(ease!=null) {
            tween.tweenType = LeanTweenType.linear;
            if( ease.GetType() ==typeof( LeanTweenType) ){
                tween.tweenType = (LeanTweenType)ease;// Enum.Parse(typeof(LeanTweenType), optional["ease"].ToString());
            } else if(ease.GetType() == typeof(AnimationCurve)){
                tween.animationCurve = optional["ease"] as AnimationCurve;
            } else{
                string func = optional["ease"].ToString();
                if(func.Equals("easeOutQuad")){
                    tween.tweenType = LeanTweenType.easeOutQuad;
                }else if(func.Equals("easeInQuad")){
                    tween.tweenType = LeanTweenType.easeInQuad;
                }else if(func.Equals("easeInOutQuad")){
                    tween.tweenType = LeanTweenType.easeInOutQuad;
                }
            }
            optionsNotUsed++;
        }
        if(optional["rect"]!=null){
            tween.ltRect = (LTRect)optional["rect"];
            optionsNotUsed++;
        }
        if(optional["path"]!=null){
            tween.path = (LTBezierPath)optional["path"];
            optionsNotUsed++;
        }
        if(optional["delay"]!=null){
            tween.delay = (float)optional["delay"];
            optionsNotUsed++;
        }
        if(optional["useEstimatedTime"]!=null){
            tween.useEstimatedTime =(bool) optional["useEstimatedTime"];
            optionsNotUsed++;
        }
        if(optional["useFrames"]!=null){
            tween.useFrames =(bool) optional["useFrames"];
            optionsNotUsed++;
        }
        if(optional["loopType"]!=null){
            tween.loopType = (LeanTweenType)optional["loopType"];
            optionsNotUsed++;
        }
        if(optional["repeat"]!=null){
            tween.loopCount = (int)optional["repeat"];
            if(tween.loopType==LeanTweenType.once)
                tween.loopType = LeanTweenType.clamp;
            optionsNotUsed++;
        }
        if(optional["point"]!=null){
            tween.point = (Vector3)optional["point"];
            optionsNotUsed++;
        }
        if(optional["axis"]!=null){
            tween.axis = (Vector3)optional["axis"];
            optionsNotUsed++;
        }
        if(optional.Count <= optionsNotUsed)
            tween.optional = null;  // nothing else is used with the extra piece, so set to null
        }else{
        tween.optional = null;
        }
        //Debug.Log("pushing new tween["+i+"]:"+tweens[i]);

        return tweens[i].uniqueId;
    }