From 3d4eeadda335c5f1bb84ab33c699aa0e96612a6d Mon Sep 17 00:00:00 2001 From: Afeijia Date: Wed, 3 Jul 2024 14:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=A5=E5=BF=97-20240703-1?= =?UTF-8?q?400=EF=BC=9A=201=E3=80=81=E6=81=A2=E5=A4=8D=E4=BA=86=E6=BC=AB?= =?UTF-8?q?=E6=B8=B8=E9=80=9F=E5=BA=A6=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/wj/Camera/CameraRoamManager.cs | 84 ++++++++++--------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs b/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs index b05e1c49..1d2bbbeb 100644 --- a/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs +++ b/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs @@ -63,7 +63,7 @@ public class CameraRoamManager : Singleton /// /// 漫游速度 /// - public float RoamingSpeed = 2; + public float RoamingSpeed = 10; /// /// Dopath参数 /// @@ -86,10 +86,52 @@ public class CameraRoamManager : Singleton /// 约束值 /// public Vector3 ConstraintValue; + + + #region 新漫游 + + /// + /// 路径移动协程 + /// + Coroutine Coroutine; + /// + /// 等待时间 + /// + WaitForSeconds WaitForSeconds = null; + /// + /// 模拟帧率 + /// + float _frame = 0.02f; + /// + /// 下一个路径点 + /// + int _Next_Index = -1; + /// + /// 实时路径点 + /// + List _Anchor_Point = new List(); + /// + /// 计算循环点 + /// + bool _init_anchor_points = false; + /// + /// 漫游是否已开始 + /// + bool _roaming_started = false; + /// + /// 循环起始点 + /// + public int LoopStartPoint = 3; ///// - ///// 漫游相机查看类型 + ///// 漫游速度 ///// - //public LookType LookType; + //[Range(0,100)] + //public float RoamingSpeed = 10; + + #endregion + + + // Start is called before the first frame update void Start() { @@ -206,38 +248,6 @@ public class CameraRoamManager : Singleton } isRoaming = _roaming; } - /// - /// 路径移动协程 - /// - Coroutine Coroutine; - /// - /// 等待时间 - /// - WaitForSeconds WaitForSeconds = null; - /// - /// 模拟帧率 - /// - float _frame = 0.02f; - /// - /// 下一个路径点 - /// - int _Next_Index = -1; - /// - /// 实时路径点 - /// - List _Anchor_Point = new List(); - /// - /// 计算循环点 - /// - bool _init_anchor_points = false; - /// - /// 漫游是否已开始 - /// - bool _roaming_started = false; - /// - /// - /// - public int LoopStartPoint = 3; /// /// @@ -280,8 +290,6 @@ public class CameraRoamManager : Singleton Vector3 _rt_pos;//实时坐标 float _t = 0.1f;//Lerp频次 float _to = 0;//Lerp进度 - float _lerp_speed = 10;//Lerp速度 - while (_loop < 0 ? true : _loop_time <= _loop)//判断循环次数 { @@ -311,7 +319,7 @@ public class CameraRoamManager : Singleton } _to += _t; - _rt_pos = Lerp(_pos, _Anchor_Point[_Next_Index].Position, _to / Vector3.Distance(_pos, _Anchor_Point[_Next_Index].Position) * _lerp_speed); + _rt_pos = Lerp(_pos, _Anchor_Point[_Next_Index].Position, _to / Vector3.Distance(_pos, _Anchor_Point[_Next_Index].Position) * RoamingSpeed); TargetCamera.position = _rt_pos; _at_point = TargetCamera.position == _Anchor_Point[_Next_Index].Position;