Exemple #1
0
    /// <summary>
    /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens
    /// </summary>
    public static void addTween(AbstractTween 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 != DuplicatePropertyRuleType.None && tween is Tween)
        {
            // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween
            if (handleDuplicatePropertiesInTween(tween as Tween))
            {
                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 Tween && ((Tween)tween).isFrom && tween.state != TweenState.Paused)
        {
            tween.update(0);
        }

        // should we start up the time scale independent update?
        if (!_instance._timeScaleIndependentUpdateIsRunning && tween.updateType == UpdateType.TimeScaleIndependentUpdate)
        {
            _instance.StartCoroutine(_instance.timeScaleIndependentUpdate());
        }
    }
Exemple #2
0
    /// <summary>
    /// adds an AbstractTween (Tween, TweenChain or TweenFlow) to the current list of running Tweens
    /// </summary>
    public static void addTween( AbstractTween 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 != DuplicatePropertyRuleType.None && tween is Tween )
        {
            // if handleDuplicatePropertiesInTween returns true it indicates we should not add this tween
            if( handleDuplicatePropertiesInTween( tween as Tween ) )
                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 Tween && ((Tween)tween).isFrom && tween.state != TweenState.Paused )
            tween.update( 0 );

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