瀏覽代碼

增加战斗开场镜头扫射场景

大爷 1 年之前
父節點
當前提交
5abb660cc2

+ 2 - 1
Unity/Assets/Scenes/Init.unity.meta

@@ -1,6 +1,7 @@
 fileFormatVersion: 2
-guid: e0d691ac8c1d0454ba07089ea820e18a
+guid: cf01fcfebeaab8845bd8e73425d381bc
 DefaultImporter:
+  externalObjects: {}
   userData: 
   assetBundleName: 
   assetBundleVariant: 

+ 3 - 1
Unity/Assets/Scripts/Codes/Hotfix/Client/Login/EnterMapHelper.cs

@@ -26,7 +26,9 @@ namespace ET.Client
 
                 SceneChangeHelper.SceneChangeTo(clientScene, mapinfo, g2CEnterMap.MapInstanceId).Coroutine();
                 // 等待场景切换完成
-                await clientScene.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
+                var task =  clientScene.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
+
+                Log.Debug("tell bat svr i'm ready.");
                 //告诉战斗服 i am ready
                 clientScene.GetComponent<SessionComponent>().Session.Send(new BattleClientReady());
             }

+ 18 - 3
Unity/Assets/Scripts/Codes/HotfixView/Client/Camera/CameraMgr.cs

@@ -1,5 +1,4 @@
 using DG.Tweening;
-using FairyGUI;
 using UnityEngine;
 
 namespace ET.Client
@@ -10,11 +9,11 @@ namespace ET.Client
         //相机跟随主角
         public static void FollowMe(Vector3 pos)
         {
-            var camera = Camera.main;
+            /*var camera = Camera.main;
             pos.x += 7;
             pos.y = 15;
             pos.z -= 25;
-            camera.transform.position = pos;
+            camera.transform.position = pos;*/
         }
 
         private static bool bShaking = false;
@@ -31,5 +30,21 @@ namespace ET.Client
                 bShaking = false;
             });
         }
+
+        public static Vector3 CarmeraPos()
+        {
+            return Camera.main.transform.position;
+        }
+
+        public static void DragCamera(Vector3 start, Vector3 end, float duration, System.Action endcb)
+        {
+            Transform trans = GlobalViewComponent.Instance.BattleCamera.transform;
+            trans.position = start;
+            var tweener = trans.DOMove(end, duration);
+            tweener.OnComplete<Tweener>(() =>
+            {
+                endcb ?.Invoke();
+            });
+        }
     }
 }

+ 10 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/Scene/SceneChangeStart_AddComponent.cs

@@ -1,4 +1,5 @@
 using Cysharp.Threading.Tasks;
+using UnityEngine;
 
 namespace ET.Client
 {
@@ -21,10 +22,18 @@ namespace ET.Client
             UIHelper.SetVisible("Loading", false);
 
             await GameObjectPool.Instance.CacheSceneObject(mapInfo.Id);
+            Log.Debug($"cache scene object end.");
 
             // 通知等待场景切换的协程
             EventSystem.Instance.Publish<EventType.SceneLoadFinish>();
-            scene.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
+
+            Vector3 StartPos = new(30, 30, 0);
+            Vector3 EndPos = new(230, 30, 0);
+            CameraMgr.DragCamera(StartPos, EndPos, 7, () =>
+            {
+                Log.Debug("camera scroll end");
+                scene.GetComponent<ObjectWait>().Notify(new Wait_SceneChangeFinish());
+            });
         }
     }
 }