// Public Functions
    /// <summary>
    /// Perform the entering animation of the title "Player's Turn"
    /// </summary>
    /// <param name="_bIsAnimate"> Determine if the transition should be animated (or snapped into place) </param>
    public void TransitionEnter(bool _bIsAnimate)
    {
        // for: Every title element...
        for (int i = 0; i < marr_trTitleElement.Length; i++)
        {
            // if: Animation is selected
            if (_bIsAnimate)
            {
                // Snap the element into position
                TransitionExit(false);

                // Execute an action
                DelayAction       actDelay     = new DelayAction(i * m_fNextElementDelay);
                LocalMoveToAction actMoveEnter = new LocalMoveToAction(marr_trTitleElement[i], Graph.Bobber, marr_vec3DisplayPosition[i], 0.15f);
                ActionSequence    actSequence  = new ActionSequence(actDelay, actMoveEnter);

                // if: The last action completed should activate the next animation
                if (i == marr_trTitleElement.Length - 1)
                {
                    actSequence.OnActionFinish += () => { UI_PlayerTurn.Instance.TransitionEnter(true, true); }
                }
                ;

                ActionHandler.RunAction(actSequence);
            }
            else
            {
                marr_trTitleElement[i].localPosition = marr_vec3DisplayPosition[i];
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Zoom the camera in towards a target
    /// </summary>
    /// <param name="_vec3TargetPosition"> The target position the camera will be zoom in towards </param>
    /// <param name="_bIsAnimate"> Determine if the pan snaps to target directly or have an Action sequence </param>
    public void ZoomInAt(Vector3 _vec3TargetPosition, bool _bIsAnimate)
    {
        if (m_bIsTransiting)
        {
            return;
        }

        // if: Animation is not specified
        if (!_bIsAnimate)
        {
            m_trCamera.position = transform.position - m_vec3CameraDirection * m_fZoomDistanceFromTarget;
            transform.position  = _vec3TargetPosition;
            m_bIsZoom           = true;
            return;
        }
        else
        {
            LocalMoveToAction actZoomInCamera = new LocalMoveToAction(m_trCamera, Graph.SmoothStep, -m_vec3CameraDirection * m_fZoomDistanceFromTarget, 0.25f);
            MoveToAction      actLookAtTarget = new MoveToAction(transform, Graph.SmoothStep, _vec3TargetPosition, 0.25f);
            actLookAtTarget.OnActionFinish += () =>
            {
                m_bIsTransiting = false;
                m_bIsZoom       = true;
            };

            ActionHandler.RunAction(actZoomInCamera, actLookAtTarget);
            m_bIsTransiting = true;
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Perform a card-exiting transition
    /// </summary>
    /// <param name="_bIsAnimate"> Determine if the transition should be animated (or snapped into place) </param>
    public void TransitionExit(bool _bIsAnimate, bool _bIsTransitTitle)
    {
        // if: Title is not transiting
        if (_bIsTransitTitle)
        {
            UI_PlayerTurnTitle.Instance.TransitionExit(_bIsAnimate);
        }

        // for: Every card...
        for (int i = 0; i < m_nCardCount; i++)
        {
            // Set the current card to the hidden position
            ChangeCardColor(i, m_colorCard, m_colorCardHighlight);
            Vector3 vec3NewHidePosition = marr_trCards[i].localPosition;
            vec3NewHidePosition.y = m_fDefaultYHeight - m_fHideHeight;

            // if: Animation is allowed
            if (_bIsAnimate)
            {
                LocalMoveToAction actMoveToPosition = new LocalMoveToAction(marr_trCards[i], Graph.Dipper, vec3NewHidePosition, 0.15f);
                ActionHandler.RunAction(actMoveToPosition);
            }
            else
            {
                marr_trCards[i].localPosition = vec3NewHidePosition;
            }
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// Perform the swap animation for the enemy's name
 /// </summary>
 /// <param name="_bIsAnimate"> Determine if the transition should be animated (or snapped into place) </param>
 public void TransitionEnemy(bool _bIsAnimate, string _strName)
 {
     if (_bIsAnimate)
     {
         LocalMoveToAction actDropDown = new LocalMoveToAction(marr_trTitleElement[3], Graph.Exponential, marr_vec3HidePosition[3], 0.1f);
         LocalMoveToAction actRiseUp   = new LocalMoveToAction(marr_trTitleElement[3], Graph.InverseExponential, marr_vec3DisplayPosition[3], 0.1f);
         actDropDown.OnActionFinish += () =>
         {
             m_textEnemy.text = _strName;
         };
         ActionSequence actSequence = new ActionSequence(actDropDown, actRiseUp);
         ActionHandler.RunAction(actSequence);
     }
     else
     {
         m_textEnemy.text = _strName;
     }
 }
    /// <summary>
    /// Perform the exiting animation of the title "Player's Turn"
    /// </summary>
    /// <param name="_bIsAnimate"> Determine if the transition should be animated (or snapped into place) </param>
    public void TransitionExit(bool _bIsAnimate)
    {
        // for: Every title element...
        for (int i = 0; i < marr_trTitleElement.Length; i++)
        {
            // if: Animation is selected
            if (_bIsAnimate)
            {
                // Snap the element into position
                TransitionEnter(false);

                // Execute an action
                DelayAction       actDelay    = new DelayAction(i * m_fNextElementDelay);
                LocalMoveToAction actMoveExit = new LocalMoveToAction(marr_trTitleElement[i], Graph.Bobber, marr_vec3HidePosition[i], 0.15f);
                ActionSequence    actSequence = new ActionSequence(actDelay, actMoveExit);

                ActionHandler.RunAction(actSequence);
            }
            else
            {
                marr_trTitleElement[i].localPosition = marr_vec3HidePosition[i];
            }
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// Perform the card-entering transition
    /// </summary>
    /// <param name="_bIsAnimate"> Determine if the transition should be animated (or snapped into place) </param>
    /// <param name="_bIsDelay"> Determine if there should be delay between each card that is transiting in </param>
    public void TransitionEnter(bool _bIsAnimate, bool _bIsDelay)
    {
        EnumPieceType[] enumCards = LevelManager.Instance.PlayerInstance.CardDeck;
        for (int i = 0; i < m_nCardCount; i++)
        {
            // vec3NewCardPosition: Determine where the new card position will be, regardless of the previous position
            Vector3 vec3NewCardPosition = Vector3.zero;
            switch (enumCards[i])
            {
            case EnumPieceType.Null:
                // Set-up the card's display
                marr_textHeader[i].text    = "NAME";
                marr_textSubheader[i].text = "...";

                // Set the current card to the hidden position
                vec3NewCardPosition   = marr_trCards[i].localPosition;
                vec3NewCardPosition.y = m_fDefaultYHeight - m_fHideHeight;
                break;

            default:
                // Set-up the card's display
                marr_textHeader[i].text = enumCards[i].ToString();

                // if: The current card does not have a card order
                if (marr_nCardOrder[i] == -1)
                {
                    // Set the current card to the display position
                    vec3NewCardPosition   = marr_trCards[i].localPosition;
                    vec3NewCardPosition.y = m_fDefaultYHeight - m_fDisplayHeight;
                }
                else
                {
                    // switch: Based on the card order to determine card's sub-header data
                    switch (marr_nCardOrder[i])
                    {
                    case 0:
                        marr_textSubheader[i].text = "1st";
                        break;

                    case 1:
                        marr_textSubheader[i].text = "2nd";
                        break;

                    case 2:
                        marr_textSubheader[i].text = "3rd";
                        break;

                    default:
                        Debug.LogWarning(name + ".UI_PlayerTurn.TransitionEnter(): Not registered marr_nCardOrder[i]! marr_nCardOrder[i]: " + marr_nCardOrder[i]);
                        break;
                    }

                    // Set the current card to the display position
                    vec3NewCardPosition   = marr_trCards[i].localPosition;
                    vec3NewCardPosition.y = m_fDefaultYHeight - m_fSelectedHeight;
                }
                break;
            }

            // if: Animation is allowed
            if (_bIsAnimate)
            {
                // if: Delay is allowed
                if (_bIsDelay)
                {
                    DelayAction       actDelay          = new DelayAction(i * m_fNextCardAppearDelay);
                    LocalMoveToAction actMoveToPosition = new LocalMoveToAction(marr_trCards[i], Graph.Bobber, vec3NewCardPosition, 0.15f);
                    ActionSequence    actSequence       = new ActionSequence(actDelay, actMoveToPosition);

                    ActionHandler.RunAction(actSequence);
                }
                else
                {
                    LocalMoveToAction actMoveToPosition = new LocalMoveToAction(marr_trCards[i], Graph.Bobber, vec3NewCardPosition, 0.15f);

                    ActionHandler.RunAction(actMoveToPosition);
                }
            }
            else
            {
                marr_trCards[i].localPosition = vec3NewCardPosition;
            }
        }
    }