Ejemplo n.º 1
0
        private void Update()
        {
            //  m_CameraRefocus.GetFocusPoint();
            Vector3 newCameraPosition;

            if (rigidbodyFirstPersonController.GetComponent <Rigidbody>().velocity.magnitude > 0 && rigidbodyFirstPersonController.Grounded())
            {
                Camera.transform.localPosition = motionBob.DoHeadBob(rigidbodyFirstPersonController.GetComponent <Rigidbody>().velocity.magnitude); // *(rigidbodyFirstPersonController.Running ? RunningStrideLengthen : 1f));
                newCameraPosition    = Camera.transform.localPosition;
                newCameraPosition.y  = Camera.transform.localPosition.y - jumpAndLandingBob.Offset();
                newCameraPosition.z += .33f;
            }
            else
            {
                newCameraPosition   = Camera.transform.localPosition;
                newCameraPosition.y = m_OriginalCameraPosition.y - jumpAndLandingBob.Offset();
            }
            Camera.transform.localPosition = newCameraPosition;

            if (!m_PreviouslyGrounded && rigidbodyFirstPersonController.Grounded())
            {
                StartCoroutine(jumpAndLandingBob.DoBobCycle());
            }

            m_PreviouslyGrounded = rigidbodyFirstPersonController.Grounded();
            //  m_CameraRefocus.SetFocusPoint();
        }