提交日志-20240703-1400:

1、恢复了漫游速度参数面板控制功能
This commit is contained in:
Afeijia 2024-07-03 14:00:01 +08:00
parent 520d9cb2b3
commit 3d4eeadda3
1 changed files with 46 additions and 38 deletions

View File

@ -63,7 +63,7 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
/// <summary>
/// 漫游速度
/// </summary>
public float RoamingSpeed = 2;
public float RoamingSpeed = 10;
/// <summary>
/// Dopath参数
/// </summary>
@ -86,10 +86,52 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
/// 约束值
/// </summary>
public Vector3 ConstraintValue;
#region
/// <summary>
/// 路径移动协程
/// </summary>
Coroutine Coroutine;
/// <summary>
/// 等待时间
/// </summary>
WaitForSeconds WaitForSeconds = null;
/// <summary>
/// 模拟帧率
/// </summary>
float _frame = 0.02f;
/// <summary>
/// 下一个路径点
/// </summary>
int _Next_Index = -1;
/// <summary>
/// 实时路径点
/// </summary>
List<RoamingAnchor> _Anchor_Point = new List<RoamingAnchor>();
/// <summary>
/// 计算循环点
/// </summary>
bool _init_anchor_points = false;
/// <summary>
/// 漫游是否已开始
/// </summary>
bool _roaming_started = false;
/// <summary>
/// 循环起始点
/// </summary>
public int LoopStartPoint = 3;
///// <summary>
///// 漫游相机查看类型
///// 漫游速度
///// </summary>
//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<CameraRoamManager>
}
isRoaming = _roaming;
}
/// <summary>
/// 路径移动协程
/// </summary>
Coroutine Coroutine;
/// <summary>
/// 等待时间
/// </summary>
WaitForSeconds WaitForSeconds = null;
/// <summary>
/// 模拟帧率
/// </summary>
float _frame = 0.02f;
/// <summary>
/// 下一个路径点
/// </summary>
int _Next_Index = -1;
/// <summary>
/// 实时路径点
/// </summary>
List<RoamingAnchor> _Anchor_Point = new List<RoamingAnchor>();
/// <summary>
/// 计算循环点
/// </summary>
bool _init_anchor_points = false;
/// <summary>
/// 漫游是否已开始
/// </summary>
bool _roaming_started = false;
/// <summary>
///
/// </summary>
public int LoopStartPoint = 3;
/// <summary>
///
@ -280,8 +290,6 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
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<CameraRoamManager>
}
_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;