Ejemplo n.º 1
0
    /// <summary>
    /// Plays the outro for the menu.
    /// </summary>
    private void AnimateOutro( RectTransform sliding, CanvasGroup fading, MenuDestinations d )
    {
        //Disable input
        allowInput = false;

        //Start animation
        Sequence s = DOTween.Sequence ( )
            .Append ( fading.DOFade ( 0, FADE_TIME ) )
            .Append ( sliding.DOAnchorPos ( new Vector2 ( -sliding.rect.width, 0 ), SLIDE_TIME ) )
            .OnComplete ( () =>
            {
                //Enable input
                allowInput = true;

                //Check transistion
                switch ( d )
                {
                    case MenuDestinations.RulesToAbilites:
                        //Hide button
                        abilityButton.SetActive ( false );

                        //Hide menu panel
                        rulesPanel.gameObject.SetActive ( false );

                        //Display ability panel
                        abilitiesPanel.gameObject.SetActive ( true );

                        //Set scroll panel to the top
                        scroll.value = 1;

                        //Display first ability
                        OnAbilityClick ( abilityButtons [ 0 ], false );

                        //Play intro
                        AnimateIntro ( abilitiesPanel, fading );
                        break;
                    case MenuDestinations.AbilitiesToRules:
                        //Hide ability panel
                        abilitiesPanel.gameObject.SetActive ( false );

                        //Display menu panel
                        rulesPanel.gameObject.SetActive ( true );

                        //Display overview
                        OnMenuClick ( menuButtons [ 3 ], false );

                        //Play intro
                        AnimateIntro ( rulesPanel, fading );
                        break;
                    case MenuDestinations.Tutorial:
                        Application.LoadLevel ( "Game Board" );
                        break;
                    case MenuDestinations.None:
                        Application.LoadLevel ( "Main Menu" );
                        break;
                }
            } )
            .SetRecyclable ( )
            .Play ( );
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Animates the tiles on screen.
    /// </summary>
    private void AnimateTiles( MenuDestinations destination )
    {
        //Disable input
        allowInput = false;

        //Start animation
        Sequence s = DOTween.Sequence ( );
        for ( int i = 0; i < waves.Length; i++ )
        {
            foreach ( Transform child in waves [ i ].transform )
                s.Insert ( i * ( DELAY_TIME * ANIMATE_TIME ), child.DOPunchScale ( new Vector3 ( -1, -1, -1 ), ANIMATE_TIME, 1, 1 ) );
        }

        s.SetRecyclable ( )
            .OnComplete ( () =>
            {
                //Enable input
                allowInput = true;

                //Check destination
                switch ( destination )
                {
                    case MenuDestinations.StartGame:
                        Application.LoadLevel ( "Start Game" );
                        break;
                    case MenuDestinations.HowToPlay:
                        Application.LoadLevel ( "Rules" );
                        break;
                    case MenuDestinations.Quit:
                        Application.Quit ( );
                        break;
                }
            } )
            .Play ( );
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Plays the outro animation.
    /// </summary>
    private void AnimateOutro( MenuDestinations d )
    {
        //Disable input
        allowInput = false;

        //Play animation
        Sequence s = DOTween.Sequence ( );
        if ( menuPanels [ 0 ].gameObject.activeSelf )
            s.Append ( menuPanels [ 0 ].DOFade ( 0, FADE_TIME ) );
        else if ( menuPanels [ 1 ].gameObject.activeSelf )
        {
            s.Append ( menuPanels [ 1 ].DOFade ( 0, FADE_TIME ) );
            for ( int i = 0; i < tiles.Length; i++ )
                s.Insert ( 0, tiles [ i ].DOFade ( 0, FADE_TIME ) );
            for ( int i = 0; i < player1.pieces.Length; i++ )
                s.Insert ( 0, player1.pieces [ i ].DOFade ( 0, FADE_TIME ) );
            for ( int i = 0; i < player2.pieces.Length; i++ )
                s.Insert ( 0, player2.pieces [ i ].DOFade ( 0, FADE_TIME ) );
        }
        else if ( menuPanels [ 2 ].gameObject.activeSelf )
            s.Append ( menuPanels [ 2 ].DOFade ( 0, FADE_TIME ) );
        s.Append ( sideBar.DOAnchorPos ( new Vector2 ( -sideBar.rect.width, 0 ), SLIDE_TIME ) )
            .OnComplete ( () =>
            {
                //Check destination
                switch ( d )
                {
                    case MenuDestinations.AbilitySelection:
                        Application.LoadLevel ( "Select Abilities" );
                        break;
                    case MenuDestinations.LoadGame:
                        Application.LoadLevel ( "Game Board" );
                        break;
                    case MenuDestinations.MainMenu:
                        Application.LoadLevel ( "Main Menu" );
                        break;
                }
            } )
            .SetRecyclable ( )
            .Play ( );
    }