wangguan
2020-12-22 3c54c3efb141adf11146eff7678e363f1be9cad3
Assets/Scripts/Core/Camera/ViewPortAdj.cs
@@ -11,14 +11,29 @@
    /// </summary>
    public UnityEngine.Camera cachedCamera { get; private set; }
    private Vector3 cachedCameraPos;
    public UnityEngine.Camera backGroundCamera { get; private set; }
    private Vector3 backGroundCameraPos;
    public bool bAdjViewPort = false;
    public void DOShakePosition(){
        cachedCamera.DOShakePosition(0.25f, 1.5f, 4);
        backGroundCamera.DOShakePosition(0.25f, 1.5f, 4);
    public void DOShakePosition()
    {
        KTGMGemClient.GameConfig.IsShaking = true;
        cachedCamera.DOShakePosition(0.25f, 1.5f, 4).OnComplete(() =>
        {
            KTGMGemClient.GameConfig.IsShaking = false;
            cachedCamera.transform.position = cachedCameraPos;
        });
        backGroundCamera.DOShakePosition(0.25f, 1.5f, 4).OnComplete(() =>
        {
            backGroundCamera.transform.position = backGroundCameraPos;
        });
    }
    public void adjViewportRect()
    {
@@ -34,12 +49,15 @@
        //bAdjViewPort = true;
    }
    protected override void Awake()
    {
        base.Awake();
        cachedCamera = GetComponent<UnityEngine.Camera>();
        backGroundCamera = GameObject.Find("BackCamera").GetComponent<UnityEngine.Camera>();
        cachedCameraPos = cachedCamera.transform.position;
        backGroundCameraPos = backGroundCamera.transform.position;
    }
    // Start is called before the first frame update
@@ -47,12 +65,13 @@
    {
        // 初始化的时候调整视口就OK了.
        this.adjViewportRect();
        Application.targetFrameRate = 60;
    }
    // Update is called once per frame
    void Update()
    {
        this.adjViewportRect();
        Application.targetFrameRate = 60;
        //this.adjViewportRect();
        //Application.targetFrameRate = 60;
    }
}