Exemplo n.º 1
0
    public void SetCameraOffset(float fProgress)
    {
        m_fAngleX = Cam_XRotMin + (Cam_XRotMax - Cam_XRotMin) * fProgress;
        m_fDis    = Cam_Near + (Cam_Far - Cam_Near) * fProgress;

        m_fProgress = fProgress;

        // 计算镜头偏移
        ClacCameraOffset();

        if (m_Target == null)
        {
            return;
        }

        if (m_Camera == null)
        {
            return;
        }

        Vector3 pos = m_Target.GetPos();

        m_lastPos = pos;

        pos.y += m_fYOffset; // 将目标上移
        Vector3 camNewPos = pos + m_Offset;

        m_Camera.LookAt(camNewPos, pos, Vector3.up);

        if (m_AudioListenerTrans != null && m_Target != null)
        {
            m_AudioListenerTrans.position = m_Target.GetNode().GetWorldPosition();
        }
    }
Exemplo n.º 2
0
    void SetSelectTargetEffectPos()
    {
        Client.IEntity entity = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget();
        Vector3        pos    = Vector3.zero;

        if (entity != null)
        {
            pos = maincamera.WorldToViewportPoint(entity.GetNode().GetWorldPosition());
            pos = uicamera.ViewportToWorldPoint(pos);
            m_effctSelect.GetNode().SetWorldPosition(pos);
        }
        else
        {
            m_effctSelect.GetNode().SetLocalPosition(new Vector3(0, 150, 0));
        }
        pos   = m_effctSelect.GetNode().GetLocalPosition();
        pos.x = Mathf.FloorToInt(pos.x);
        pos.y = Mathf.FloorToInt(pos.y) + 25;
        pos.z = 0f;
        m_effctSelect.GetNode().SetLocalPosition(pos);
    }