Exemplo n.º 1
0
    private void UpdateTween(float num)
    {
        string strCameraName = "MainCamera";

        Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName);
        if (cam == null)
        {
            return;
        }

        cam.SetFieldOfView(num);
    }
Exemplo n.º 2
0
    private void PlayMovie_Start()
    {
        OfflineManager omgr = DataManager.Manager <OfflineManager>();

        omgr.mShowAdvertise = false;

        //设置相机参数
        string strCameraName = "MainCamera";

        Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName);
        if (cam == null)
        {
            return;
        }
        cam.SetFarClipPlane(250);


        if (cam.GetNode().GetTransForm().gameObject.GetComponent <PostRender.K3DPostRenderRadialBlur>() == null)
        {
            post = cam.GetNode().GetTransForm().gameObject.AddComponent <PostRender.K3DPostRenderRadialBlur>();
        }

        m_uSaveHeartTime = Protocol.Instance.SetHeartBeat(4000000);
    }
Exemplo n.º 3
0
    private void MovieEnd()
    {
        string strCameraName = "MainCamera";

        Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName);
        if (cam == null)
        {
            return;
        }

        CameraFollow.Instance.camera = null;

        Vector3 savePos = new Vector3(-28.52f, 97.2f, -121.51f);

        Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (pPlayer == null)
        {
            return;
        }

        newPos   = cam.GetNode().GetWorldPosition();
        newPos.y = 49.36f;

        cam.GetNode().GetTransForm().position = savePos;

        //旋转
        Vector3    rotationVector3 = new Vector3(34.923f, 52.184f, 1.782f);
        Quaternion rotation        = Quaternion.Euler(rotationVector3);

        cam.GetNode().GetTransForm().rotation = rotation;

        cam.SetFieldOfView(30);

        RenderSettings.fogStartDistance = 60f;
        RenderSettings.fogEndDistance   = 250f;

        // 3 秒内 旋转角度 到(38f, 45f, 0f)
        //cam.GetNode().GetTransForm().DORotate(new Vector3(38f, 45f, 0f), 3);

        //float fieldOfView = 30;
        //Tween t = DOTween.To(() => fieldOfView, x => fieldOfView = x, 45, 3);
        //// 给执行 t 变化时,每帧回调一次 UpdateTween 方法
        //t.OnUpdate(() => UpdateTween(fieldOfView));


        //float fFogStartDistance = 60;
        //float fFogEndDistance = 250;
        //RenderSettings.fogStartDistance = fFogStartDistance;
        //RenderSettings.fogEndDistance = fFogEndDistance;

        //Tween t1 = DOTween.To(() => fFogStartDistance, x => fFogStartDistance = x, 20, 3);
        //t1.OnUpdate(() => UpdateFogStartDistance(fFogStartDistance));

        //Tween t2 = DOTween.To(() => fFogEndDistance, x => fFogEndDistance = x, 170, 3);
        //t2.OnUpdate(() => UpdateFogEndDistance(fFogEndDistance));


        //Tweener tweener = cam.GetNode().GetTransForm().DOMove(newPos, 3f);

        UIManager.Instance.SetCameraState(false);


        Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
        if (cs != null)
        {
            cs.GetActiveCtrl().SetHost(null);
        }

        Invoke("MovieEnd_Impl", 2f);
    }
Exemplo n.º 4
0
    private void MovieEnd_Impl()
    {
        string strCameraName = "MainCamera";

        Engine.ICamera cam = Engine.RareEngine.Instance().GetRenderSystem().GetCamera(ref strCameraName);
        if (cam == null)
        {
            return;
        }

        ///rotate
        cam.GetNode().GetTransForm().DORotate(new Vector3(38f, 45f, 0f), 3);

        ///fieldofview
        float fieldOfView = 30;
        Tween t           = DOTween.To(() => fieldOfView, x => fieldOfView = x, 45, 3);

        // 给执行 t 变化时,每帧回调一次 UpdateTween 方法
        t.OnUpdate(() => UpdateTween(fieldOfView));

        /// fog
        float fFogStartDistance = 60;
        float fFogEndDistance   = 250;

        RenderSettings.fogStartDistance = fFogStartDistance;
        RenderSettings.fogEndDistance   = fFogEndDistance;

        Tween t1 = DOTween.To(() => fFogStartDistance, x => fFogStartDistance = x, 20, 3);

        t1.OnUpdate(() => UpdateFogStartDistance(fFogStartDistance));

        Tween t2 = DOTween.To(() => fFogEndDistance, x => fFogEndDistance = x, 170, 3);

        t2.OnUpdate(() => UpdateFogEndDistance(fFogEndDistance));

        // move
        Tweener tweener = cam.GetNode().GetTransForm().DOMove(newPos, 3f);

        //Audio
        table.ResourceDataBase rdb = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(45001);
        if (rdb != null)
        {
            PlayAudio(this.gameObject, rdb.strPath);
        }
        //

        Client.IPlayer pPlayer = Client.ClientGlobal.Instance().MainPlayer;
        if (pPlayer == null)
        {
            return;
        }
        tweener.OnComplete(() =>
        {
            CameraFollow.Instance.camera = cam;
            pPlayer = Client.ClientGlobal.Instance().MainPlayer;
            CameraFollow.Instance.target = pPlayer;
            cam.SetCameraCtrl(CameraFollow.Instance);

            cam.SetFarClipPlane(140);

            if (post != null)
            {
                GameObject.DestroyImmediate(post);
                post = null;
            }

            UIManager.Instance.SetCameraState(true);


            Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem();
            if (cs != null)
            {
                cs.GetActiveCtrl().SetHost(pPlayer);
            }

            Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CAMERA_MOVE_END, null);
        });
    }