예제 #1
0
    /// <summary>
    /// Updates the pledge thanks animation.
    /// </summary>
    private void UpdatePledgeThanksAnimation()
    {
        m_pledgeThanksAnimator.Update(Time.deltaTime);
        switch (m_pledgeThanksState)
        {
        case PledgeThanksState.SHOWING:
            if (m_pledgeThanksAnimator.IsInState2)
            {
                m_pledgeThanksState = PledgeThanksState.SHOWN;
                m_timeSinceShown    = 0.0f;
            }
            break;

        case PledgeThanksState.SHOWN:
            m_timeSinceShown += Time.deltaTime;
            if (m_timeSinceShown > m_pledgeThanksDuration)
            {
                m_pledgeThanksState = PledgeThanksState.HIDING;
                m_pledgeThanksAnimator.AnimateToState1();
            }
            break;

        case PledgeThanksState.HIDING:
            if (m_pledgeThanksAnimator.IsInState1)
            {
                m_pledgeThanksState = PledgeThanksState.HIDDEN;
                m_pledgeThanks.SetActive(false);
            }
            break;

        case PledgeThanksState.HIDDEN:
            break;
        }
    }
예제 #2
0
    /// <summary>
    /// Updates the lose animation.
    /// </summary>
    protected override void UpdateLoseAnimation()
    {
        if (m_loseAnimator == null)
        {
            return;
        }

        m_loseAnimator.Update(Time.deltaTime);

        // Make lose animation loop until SceneMaster ends the scene
        if (m_loseAnimator.IsInState1)
        {
            m_loseAnimator.AnimateToState2();
        }
        else if (m_loseAnimator.IsInState2)
        {
            m_loseAnimator.AnimateToState1();
        }
    }
예제 #3
0
    /// <summary>
    /// Shows or hides the safety pledge UI.
    /// </summary>
    /// <param name="show">If set to <c>true</c> show the pledge UI.</param>
    private void ShowPledgeUI(bool show = true)
    {
        if (show)
        {
            m_pledgeRoot.SetActive(true);
            m_pledgeOverlay.gameObject.SetActive(true);

            m_pledgeUIAnimator.AnimateToState2();
            m_pledgeOverlayAnimator.AnimateToState2();
        }
        else
        {
            m_pledgeUIAnimator.AnimateToState1();
            m_pledgeOverlayAnimator.AnimateToState1();
        }

        // Enable/Disable buttons behind the pledge UI
        m_playAgainButton.GetComponent <Collider2D>().enabled = !show;
        m_mainMenuButton.GetComponent <Collider2D>().enabled  = !show;
        m_pledgeButton.GetComponent <Collider2D>().enabled    = !show;
    }
예제 #4
0
    /// <summary>
    /// Updates the score text animation.
    /// </summary>
    private void UpdateScoreTextAnim()
    {
        m_scoreAnimator.Update(Time.deltaTime);

        switch (m_scoreAnimState)
        {
        case ScoreAnimState.Normal:
            break;

        case ScoreAnimState.Enlarging:
            if (m_scoreAnimator.IsInState2)
            {
                m_timeSinceEnlarged = 0.0f;
                m_scoreAnimState    = ScoreAnimState.Enlarged;
            }
            break;

        case ScoreAnimState.Enlarged:
            // Track time in enlarged state
            m_timeSinceEnlarged += Time.deltaTime;
            // Once it reaches the required hold time, start shrinking
            if (m_timeSinceEnlarged > m_enlargeHoldDuration)
            {
                m_timeSinceEnlarged = 0.0f;
                m_scoreAnimator.AnimateToState1();
                m_scoreAnimState = ScoreAnimState.Shrinking;
            }
            break;

        case ScoreAnimState.Shrinking:
            // Check if coins text has shrunk back to normal size
            if (m_scoreAnimator.IsInState1)
            {
                // End animation
                m_scoreAnimState = ScoreAnimState.Normal;
            }
            break;
        }
    }