From d185e655cd926e45ed7f7ce3f59af7dc23b4c372 Mon Sep 17 00:00:00 2001
From: chenxin <chenxin6991@163.com>
Date: Tue, 22 Dec 2020 09:53:07 +0800
Subject: [PATCH] Merge branch 'master' of http://47.95.218.140:8090/r/GemBattle into master

---
 Assets/Scripts/Core/Camera/ViewPortAdj.cs |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/Assets/Scripts/Core/Camera/ViewPortAdj.cs b/Assets/Scripts/Core/Camera/ViewPortAdj.cs
index 032c369..8c94784 100644
--- a/Assets/Scripts/Core/Camera/ViewPortAdj.cs
+++ b/Assets/Scripts/Core/Camera/ViewPortAdj.cs
@@ -1,4 +1,5 @@
 using Core.Utilities;
+using DG.Tweening;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
@@ -10,7 +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()
+    {
+        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()
     {
@@ -26,11 +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
@@ -38,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;
     }
 }

--
Gitblit v1.9.1