update() public méthode

tick method. if it returns true it indicates the tween is complete. note: at it's base, AbstractGoTween does not fire events, it is up to the implementer to do so. see GoTween and AbstractGoTweenCollection for examples.
public update ( float deltaTime ) : bool
deltaTime float
Résultat bool
Exemple #1
0
    /// <summary>
    /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens
    /// </summary>
    public void addTween(AbstractGoTween tween)
    {
        if (_instance == null)
        {
            _instance = this;
        }


        // early out for invalid items
        if (!tween.isValid())
        {
            return;
        }

        // dont add the same tween twice
        if (_tweens.Contains(tween))
        {
            return;
        }

        // check for dupes and handle them before adding the tween. we only need to check for Tweens
        if (duplicatePropertyRule != GoDuplicatePropertyRuleType.None && tween is GoTween)
        {
            // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween
            if (handleDuplicatePropertiesInTween(tween as GoTween))
            {
                return;
            }

            // if we became invalid after handling dupes dont add the tween
            if (!tween.isValid())
            {
                return;
            }
        }

        _tweens.Add(tween);

        // enable ourself if we are not enabled
        if (!_instance.enabled) // purposely using the static instace property just once for initialization
        {
            _instance.enabled = true;
        }

        // if the Tween isn't paused and it is a "from" tween jump directly to the start position
        if (tween is GoTween && ((GoTween)tween).isFrom && tween.state != GoTweenState.Paused)
        {
            tween.update(0);
        }

        // should we start up the time scale independent update?
        if (!_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == GoUpdateType.TimeScaleIndependentUpdate)
        {
            _instance.StartCoroutine(_instance.timeScaleIndependentUpdate());
        }

        #if UNITY_EDITOR
//        _instance.gameObject.name = string.Format("GoKit ({0} tweens)", _tweens.Count);
        #endif
    }
 static public int update(IntPtr l)
 {
     try {
         AbstractGoTween self = (AbstractGoTween)checkSelf(l);
         System.Single   a1;
         checkType(l, 2, out a1);
         var ret = self.update(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
 public static void addTween(AbstractGoTween tween)
 {
     if (tween.isValid() && !_tweens.Contains(tween) && (duplicatePropertyRule == GoDuplicatePropertyRuleType.None || !(tween is GoTween) || (!handleDuplicatePropertiesInTween(tween as GoTween) && tween.isValid())))
     {
         _tweens.Add(tween);
         if (!instance.enabled)
         {
             _instance.enabled = true;
         }
         if (tween is GoTween && ((GoTween)tween).isFrom && tween.state != GoTweenState.Paused)
         {
             tween.update(0f);
         }
         if (!_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == GoUpdateType.TimeScaleIndependentUpdate)
         {
             _instance.StartCoroutine(_instance.timeScaleIndependentUpdate());
         }
     }
 }
Exemple #4
0
    /// <summary>
    /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens
    /// </summary>
    public static void addTween( AbstractGoTween tween )
    {
        // early out for invalid items
        if( !tween.isValid() )
            return;

        // dont add the same tween twice
        if( _tweens.Contains( tween ) )
            return;

        // check for dupes and handle them before adding the tween. we only need to check for Tweens
        if( duplicatePropertyRule != GoDuplicatePropertyRuleType.None && tween is GoTween )
        {
            // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween
            if( handleDuplicatePropertiesInTween( tween as GoTween ) )
                return;

            // if we became invalid after handling dupes dont add the tween
            if( !tween.isValid() )
                return;
        }

        _tweens.Add( tween );

        // enable ourself if we are not enabled
        if( !instance.enabled ) // purposely using the static instace property just once for initialization
            _instance.enabled = true;

        // if the Tween isn't paused and it is a "from" tween jump directly to the start position
        if( tween is GoTween && ((GoTween)tween).isFrom && tween.state != GoTweenState.Paused )
            tween.update( 0 );

        // should we start up the time scale independent update?
        if( !_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == GoUpdateType.TimeScaleIndependentUpdate )
            _instance.StartCoroutine( _instance.timeScaleIndependentUpdate() );

        #if UNITY_EDITOR
        _instance.gameObject.name = string.Format( "GoKit ({0} tweens)", _tweens.Count );
        #endif
    }
Exemple #5
0
 private void handleUpdateOfType(GoUpdateType updateType, float deltaTime)
 {
     for (int num = _tweens.Count - 1; num >= 0; num--)
     {
         AbstractGoTween abstractGoTween = _tweens[num];
         if (abstractGoTween.state == GoTweenState.Destroyed)
         {
             removeTween(abstractGoTween);
         }
         else if (abstractGoTween.updateType == updateType && abstractGoTween.state == GoTweenState.Running && abstractGoTween.update(deltaTime * abstractGoTween.timeScale) && (abstractGoTween.state == GoTweenState.Destroyed || abstractGoTween.autoRemoveOnComplete))
         {
             removeTween(abstractGoTween);
             abstractGoTween.destroy();
         }
     }
 }