play() public method

resumes playback
public play ( ) : void
return void
    protected virtual void OnGUI()
    {
        if (_tween == null)
        {
            return;
        }

        GUILayout.Label("elapsed: " + string.Format("{0:0.##}", _tween.totalElapsedTime));


        if (GUILayout.Button("play"))
        {
            _tween.play();
        }

        if (GUILayout.Button("pause"))
        {
            _tween.pause();
        }

        if (GUILayout.Button("reverse"))
        {
            _tween.reverse();
        }

        if (GUILayout.Button("restart"))
        {
            _tween.restart();
        }

        if (GUILayout.Button("play backwards"))
        {
            _tween.playBackwards();
        }

        if (GUILayout.Button("play forward"))
        {
            _tween.playForward();
        }

        if (GUILayout.Button("complete"))
        {
            _tween.complete();
        }

        GUILayout.Label("Time Scale: " + string.Format("{0:0.##}", _tween.timeScale));
        var newTweenTimeScale = GUILayout.HorizontalSlider(_tweenTimeScale, 0, 3);

        if (newTweenTimeScale != _tweenTimeScale)
        {
            _tweenTimeScale  = newTweenTimeScale;
            _tween.timeScale = _tweenTimeScale;
        }

        easeTypesGUI();
    }
Esempio n. 2
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);
        tween.play();

        // 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. 3
0
 static public int play(IntPtr l)
 {
     try {
         AbstractGoTween self = (AbstractGoTween)checkSelf(l);
         self.play();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 4
0
        public override void ApplyPattern(Transform transform, ref AbstractGoTween tween)
        {
            var path = new GoSpline("little_curve_r");
            var move = Go.to(transform, 1f, new GoTweenConfig().positionPath(path, true));

            var path2 = new GoSpline("forward_top_bot");
            var move3 = Go.to(transform, 5f, new GoTweenConfig().positionPath(path2, true));

            var chain = new GoTweenChain(new GoTweenCollectionConfig().setIterations(1));

            chain.append(move);
            chain.append(move3);

            tween = chain;
            tween.play();
        }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        var path = new GoSpline("little_curve");
        var move = Go.to(transform, 1f, new GoTweenConfig()
                         .positionPath(path, true));

        var move2 = Go.to(transform, 1f, new GoTweenConfig().positionPath(path, true));

        var path2 = new GoSpline("forward_top_bot");
        var move3 = Go.to(transform, 5f, new GoTweenConfig().positionPath(path2, true));

        var chain = new GoTweenChain(new GoTweenCollectionConfig().setIterations(1));

        chain.append(move);
        chain.append(move2);
        chain.append(move3);

        _tween = chain;
        _tween.play();
    }
    public override void ApplyPattern(Transform transform, ref AbstractGoTween tween)
    {
        var path = new GoSpline("top_to_bot_one_third");
        var move = Go.to(transform, 2f, new GoTweenConfig().positionPath(path, true));

        var path2 = new GoSpline("diag_right_to_left_one_square");
        var move2 = Go.to(transform, 2f, new GoTweenConfig().positionPath(path2, true));

        var path3 = new GoSpline("top_to_bot_one_third");
        var move3 = Go.to(transform, 2f, new GoTweenConfig().positionPath(path3, true));
        var move4 = Go.to(transform, 2f, new GoTweenConfig().positionPath(path3, true));

        var chain = new GoTweenChain(new GoTweenCollectionConfig().setIterations(1));

        chain.append(move);
        chain.append(move2);
        chain.append(move3);
        chain.append(move4);

        tween = chain;
        tween.play();
    }
Esempio n. 7
0
File: Go.cs Progetto: apautrot/gdp9
    /// <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 );
        tween.play ();

        // 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
    }