Пример #1
0
    public override void Initialize()
    {
        base.Initialize();

        m_UpdateProperties = UpdatePropertyFlag.HalfTanFov
                             | UpdatePropertyFlag.Transform;

        m_MainCMBrain      = gameObject.GetComponent <CinemachineBrain>();
        m_PostProcessLayer = gameObject.GetComponent <PostProcessLayer>();
        m_HXVCamera        = gameObject.GetComponent <HxVolumetricCamera>();

        m_LastCMType = CMType.Notset;
        m_CMs        = new CMData[(int)CMType.Count];
        Transform cmRoot = transform.parent;

        for (int iCM = 0; iCM < m_CMs.Length; iCM++)
        {
            CMData cmData = new CMData(cmRoot.Find(CM_GAMEOBJECT_NAME_STARTWITHS + ((CMType)iCM).ToString())
                                       .GetComponent <CinemachineVirtualCameraBase>()
                                       , (CMType)iCM);
            m_CMs[iCM] = cmData;
        }

#if UNITY_EDITOR
        // 预览场景时,不需要读表里的相机参数,也不需要切换手柄鼠标
        if (!CameraManager._s_IsRoaming)
#endif
        {
            GamingConfig gamingConfig = ((CfgEternityProxy)GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy)).GetGamingConfig(1).Value;
            m_CM_Character_AxisSetting = new CMAxisSetting(new CMAxisSetting.CM(new CMAxisSetting.Axis(gamingConfig.CmCharacter.Value.XaxisMaxSpeedMouse)
                                                                                , new CMAxisSetting.Axis(gamingConfig.CmCharacter.Value.YaxisMaxSpeedMouse))
                                                           , new CMAxisSetting.CM(new CMAxisSetting.Axis(gamingConfig.CmCharacter.Value.XaxisMaxSpeedGamepad)
                                                                                  , new CMAxisSetting.Axis(gamingConfig.CmCharacter.Value.YaxisMaxSpeedGamepad)));
            InputManager.Instance.OnInputDeviceChanged += OnInputDeviceChanged;
        }

        m_ChangingCMs = new Queue <CMType>();
        m_ChangingCMBlendReaminTime = 0;

        m_CameraRenderer = new CRenderer.MainCameraRenderer();
        m_CameraRenderer.Initialize(GetCameraName(), m_Camera, m_CameraRendererResource);

        _ForDebug.GUIEnable = new bool[(int)GUIType.Count];

        TrackCaptureManager.GetInstance().InitializeCapturer("Main Camera", this).StartCapture();
    }
Пример #2
0
    public void ApplyCMParam(WarshipCamera cameraParam)
    {
        ApplyCMParame_FreeLook(CMType.Spacecraft
                               , cameraParam.CMSpacecraftTopRigHeight
                               , cameraParam.CMSpacecraftTopRigRadius
                               , cameraParam.CMSpacecraftMiddleRigHeight
                               , cameraParam.CMSpacecraftMiddleRigRadius
                               , cameraParam.CMSpacecraftBottomRigHeight
                               , cameraParam.CMSpacecraftBottomRigRadius
                               , cameraParam.CMSpacecraftFieldOfView);
        m_CM_Spacecraft_AxisSetting = new CMAxisSetting(new CMAxisSetting.CM(new CMAxisSetting.Axis(cameraParam.CMSpacecraftXaxisMaxSpeedMouse)
                                                                             , new CMAxisSetting.Axis(cameraParam.CMSpacecraftYaxisMaxSpeedMouse))
                                                        , new CMAxisSetting.CM(new CMAxisSetting.Axis(cameraParam.CMSpacecraftXaxisMaxSpeedGamepad)
                                                                               , new CMAxisSetting.Axis(cameraParam.CMSpacecraftYaxisMaxSpeedGamepad)));

        ApplyCMParame_VirtualCamera(CMType.LeapPrepare
                                    , cameraParam.CMLeapPrepareBodyFollowOffsetX
                                    , cameraParam.CMLeapPrepareBodyFollowOffsetY
                                    , cameraParam.CMLeapPrepareBodyFollowOffsetZ
                                    , cameraParam.CMLeapPrepareFieldOfView);

        ApplyCMParame_VirtualCamera(CMType.Leaping
                                    , cameraParam.CMLeapingBodyFollowOffsetX
                                    , cameraParam.CMLeapingBodyFollowOffsetY
                                    , cameraParam.CMLeapingBodyFollowOffsetZ
                                    , cameraParam.CMLeapingFieldOfView);

        ApplyCMParame_VirtualCamera(CMType.LeapFinish
                                    , cameraParam.CMLeapFinishBodyFollowOffsetX
                                    , cameraParam.CMLeapFinishBodyFollowOffsetY
                                    , cameraParam.CMLeapFinishBodyFollowOffsetZ
                                    , cameraParam.CMLeapFinishFieldOfView);

        //ApplyCMParame_VirtualCamera(CMType.Jet
        //	, cameraParam.CMLeapPrepareBodyFollowOffsetX
        //	, cameraParam.CMLeapPrepareBodyFollowOffsetY
        //	, cameraParam.CMLeapPrepareBodyFollowOffsetZ
        //	, cameraParam.CMLeapPrepareFieldOfView);

        OnInputDeviceChanged(InputManager.Instance.CurrentInputDevice);
    }