isValid() public abstract method

subclasses should return true if they are a valid and ready to be added to the list of running tweens or false if not ready. technically, this should be marked as internal
public abstract isValid ( ) : bool
return bool
Esempio n. 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
    }
Esempio n. 2
0
 static public int isValid(IntPtr l)
 {
     try {
         AbstractGoTween self = (AbstractGoTween)checkSelf(l);
         var             ret  = self.isValid();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 3
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
    }
Esempio n. 4
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());
         }
     }
 }