Пример #1
0
 private void SetTimescale(float timeScale)
 {
     Time.timeScale       = timeScale;
     Time.fixedDeltaTime  = 0.02f * timeScale;
     m_SourceBGM.pitch    = Interpolation.CircularOut(timeScale);
     m_Camera.fieldOfView = Mathf.LerpUnclamped(m_CameraMinFOV, m_CameraMaxFOV, timeScale);
 }
Пример #2
0
    void Update()
    {
        if (m_delayStart <= 0.0f)
        {
            //add deltaTime to the current time
            m_currentTime += Time.deltaTime;
            if (m_currentTime < m_timeToReachPosition)
            {
                //based on which effect is selected this will lerp from the curretn position to the desired position
                switch (m_effect)
                {
                //Lerps using the BouceOut Interpolation
                case Effect.BOUNCE_OUT:
                    transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.BounceOut(m_currentTime / m_timeToReachPosition));
                    break;

                //Lerps using the ElasticOut Interpolation
                case Effect.ELASTIC_OUT:
                    transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.ElasticOut(m_currentTime / m_timeToReachPosition));
                    break;

                //Lerps using the Linear Interpolation
                case Effect.LINEAR:
                    transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.Linear(m_currentTime / m_timeToReachPosition));
                    break;

                //Lerps using the CircularOut Interpolation
                case Effect.CIRCULAR_OUT:
                    transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.CircularOut(m_currentTime / m_timeToReachPosition));
                    break;

                //Lerps using the CircularInOut Interpolation
                case Effect.CIRCULAR_IN_OUT:
                    transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.CircularInOut(m_currentTime / m_timeToReachPosition));
                    break;

                //Lerps using the CircularIn Interpolation
                case Effect.CIRCULAR_IN:
                    transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.SineIn(m_currentTime / m_timeToReachPosition));
                    break;
                }

                return;
            }
            //set the current position to the desired position
            transform.position = m_desiredPos;
        }
        else
        {
            //remove Deltatime from the m_delayStart
            m_delayStart -= Time.deltaTime;
        }
    }
Пример #3
0
    /// <summary>
    /// The secondary animation across the screen.
    /// </summary>
    IEnumerator FlyInAnimation()
    {
        yield return(new WaitForSeconds(m_FlyingInStartDelay));

        while (m_currentTime < m_FlyingAcrossTimeToReachPosition)
        {
            m_currentTime     += Time.deltaTime;
            transform.position = Vector3.LerpUnclamped(m_desiredPos + m_offset, m_desiredPos, Interpolation.CircularOut(m_currentTime / m_FlyingInTimeToReachPosition));
            yield return(null);
        }
        transform.position = m_desiredPos;
    }