Exemple #1
0
    private IEnumerator MoveGameCameraAnimation()
    {
        yield return(null);

        Vector3 oldPosition = m_GameCameraContainer.transform.position;
        Vector3 newPosition = oldPosition;

        newPosition.z += m_CameraMovement;

        float ratio    = 0.0f;
        float duration = CAMERA_MOVEMENT_DURATION;

        while (ratio < 1.0f)
        {
            duration -= Time.deltaTime;

            ratio = AnimationController.GetInterpolationRatio(0.0f, CAMERA_MOVEMENT_DURATION, (CAMERA_MOVEMENT_DURATION - duration), AnimationController.EaseInOutType.Quad);
            m_GameCameraContainer.transform.position = Vector3.Lerp(oldPosition, newPosition, ratio);

            yield return(null);
        }

        m_GameCameraContainer.transform.position = newPosition;

        m_MovementEndedDelegate();
        m_MovementEndedDelegate = null;
    }
Exemple #2
0
    public void MoveGameCamera(float movement, OnCameraMovementEnded onEnded)
    {
        m_MovementEndedDelegate = onEnded;
        m_CameraMovement        = movement;

        StopCoroutine("MoveGameCameraAnimation");
        StartCoroutine("MoveGameCameraAnimation");
    }
    public void MoveGameCamera(float movement, OnCameraMovementEnded onEnded)
    {
        m_MovementEndedDelegate = onEnded;
        m_CameraMovement = movement;

        StopCoroutine("MoveGameCameraAnimation");
        StartCoroutine("MoveGameCameraAnimation");
    }
    private IEnumerator MoveGameCameraAnimation()
    {
        yield return null;

        Vector3 oldPosition = m_GameCameraContainer.transform.position;
        Vector3 newPosition = oldPosition;
        newPosition.z += m_CameraMovement;

        float ratio = 0.0f;
        float duration = CAMERA_MOVEMENT_DURATION;
        while (ratio < 1.0f)
        {
            duration -= Time.deltaTime;

            ratio = AnimationController.GetInterpolationRatio(0.0f, CAMERA_MOVEMENT_DURATION, (CAMERA_MOVEMENT_DURATION - duration), AnimationController.EaseInOutType.Quad);
            m_GameCameraContainer.transform.position = Vector3.Lerp(oldPosition, newPosition, ratio);

            yield return null;
        }

        m_GameCameraContainer.transform.position = newPosition;

        m_MovementEndedDelegate();
        m_MovementEndedDelegate = null;
    }