Exemplo n.º 1
0
        void LateUpdate()
        {
            if (m_bInvalid || !m_bStarted)
            {
                return;
            }

            switch (m_kEffect)
            {
            case Effect.Shake:
            {
                if (m_ShakeParam == null)
                {
                    Dbg.LogWarn("CC_Camera.Update: ShakeParam is null");
                    m_bInvalid = true;
                    return;
                }

                var s = m_ShakeParam;
                if (s.m_timeSinceStart > s.m_Duration)
                {     //time up
                    m_bStarted         = false;
                    s.m_timeSinceStart = 0f;
                }

                Transform camTr     = m_CamTrPath.GetTransform(m_CCTr);
                Vector3   campos    = CCPosInfo.ToWorldPos(m_CCTr, m_CamTrPath);
                Vector3   randDelta = _GenRandomShake();
                campos        += randDelta - s.m_PrevShake;
                camTr.position = campos;
                s.m_PrevShake  = randDelta;

                m_ShakeParam.m_timeSinceStart += Time.deltaTime;
            }
            break;
            }
        }