示例#1
0
 void Update()
 {
     if (null != mCameraBase && mCameraBase.m_cameraShake)
     {
         Transform tran = mCameraBase.UpdateMainCameraTransform();
         float     posY = mAniCurve.Evaluate(Time.time - mStartAniTime);
         tran.position = tran.position + new Vector3(0, posY, 0);
     }
 }
示例#2
0
        void UpdateZoom()
        {
            if (isZoomEnd)
            {
                return;
            }

            var diff = Time.time - beginTime;

            diff -= desc.playTime;
            if (m_cameraFollow == null)
            {
                return;
            }
            if (diff < 0)
            {
                m_cameraFollow.m_cameraZoom = false;
                return;
            }

            //if (origin == null)
            {
                origin  = m_cameraFollow.UpdateMainCameraTransform().position; //camTransform.position;
                forward = camTransform.forward.normalized;
                //Debug.LogError("origin : " + origin + ",   forward : " + forward);
            }

            m_cameraFollow.m_cameraZoom = true;

            float p = 0f;

            if (diff >= 0.001f)
            {
                p = m_animationCurve.Evaluate(diff);
            }

            float d = p * desc.distance;

            Vector3 add = d * forward;
            Vector3 pos = origin.Value + add;

            camTransform.position = pos;

            //Debug.LogError("p : " + p + ",   d : " + d + ",   add : " + add.magnitude + ",   time : " + diff);

            if (diff >= endTime)
            {
                isZoomEnd = true;
                if (m_cameraFollow != null)
                {
                    m_cameraFollow.m_cameraZoom = false;
                }
            }
        }
示例#3
0
        void Update()
        {
            if (m_cameraFollow != null && m_cameraFollow.m_cameraShake)
            {
                //更新主相机当前位置
                camTransform = m_cameraFollow.UpdateMainCameraTransform();

                //相机抖动的值
                float posY = m_animationCurve.Evaluate(Time.time - m_beginTime);

                camTransform.position = camTransform.position + new Vector3(0, posY, 0);
            }
        }