parent
520d9cb2b3
commit
3d4eeadda3
|
@ -63,7 +63,7 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 漫游速度
|
/// 漫游速度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float RoamingSpeed = 2;
|
public float RoamingSpeed = 10;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dopath参数
|
/// Dopath参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -86,10 +86,52 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
|
||||||
/// 约束值
|
/// 约束值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Vector3 ConstraintValue;
|
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>
|
||||||
///// 漫游相机查看类型
|
///// 漫游速度
|
||||||
///// </summary>
|
///// </summary>
|
||||||
//public LookType LookType;
|
//[Range(0,100)]
|
||||||
|
//public float RoamingSpeed = 10;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -206,38 +248,6 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
|
||||||
}
|
}
|
||||||
isRoaming = _roaming;
|
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>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -280,8 +290,6 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
|
||||||
Vector3 _rt_pos;//实时坐标
|
Vector3 _rt_pos;//实时坐标
|
||||||
float _t = 0.1f;//Lerp频次
|
float _t = 0.1f;//Lerp频次
|
||||||
float _to = 0;//Lerp进度
|
float _to = 0;//Lerp进度
|
||||||
float _lerp_speed = 10;//Lerp速度
|
|
||||||
|
|
||||||
|
|
||||||
while (_loop < 0 ? true : _loop_time <= _loop)//判断循环次数
|
while (_loop < 0 ? true : _loop_time <= _loop)//判断循环次数
|
||||||
{
|
{
|
||||||
|
@ -311,7 +319,7 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
|
||||||
}
|
}
|
||||||
|
|
||||||
_to += _t;
|
_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;
|
TargetCamera.position = _rt_pos;
|
||||||
_at_point = TargetCamera.position == _Anchor_Point[_Next_Index].Position;
|
_at_point = TargetCamera.position == _Anchor_Point[_Next_Index].Position;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue