(client)chore:修改了摄像机的跟踪方式,摄像机控制不再使用单例
This commit is contained in:
@ -6,9 +6,6 @@ namespace CameraControl
|
||||
{
|
||||
public class CameraControl : Utils.MonoSingleton<CameraControl>, ITick, ITickUI
|
||||
{
|
||||
// 当前被聚焦的目标实体
|
||||
public Entity.Entity focusedEntity = null;
|
||||
|
||||
// Camera movement variables
|
||||
private Vector3 _dragOrigin;
|
||||
private bool _isDragging = false;
|
||||
@ -50,12 +47,12 @@ namespace CameraControl
|
||||
}
|
||||
public void Tick()
|
||||
{
|
||||
if (focusedEntity)
|
||||
if (Program.Instance.focusedEntity)
|
||||
{
|
||||
// Follow the focused entity's position
|
||||
var targetPosition = new Vector3(
|
||||
focusedEntity.Position.x,
|
||||
focusedEntity.Position.y,
|
||||
Program.Instance.focusedEntity.Position.x,
|
||||
Program.Instance.focusedEntity.Position.y,
|
||||
_camera.transform.position.z);
|
||||
|
||||
_camera.transform.position = Vector3.Lerp(
|
||||
@ -86,7 +83,8 @@ namespace CameraControl
|
||||
{
|
||||
_dragOrigin = _camera.ScreenToWorldPoint(Input.mousePosition);
|
||||
_isDragging = true;
|
||||
focusedEntity = null; // Clear focus when manually moving camera
|
||||
Program.Instance.focusedEntity.PlayerControlled = false;
|
||||
Program.Instance.focusedEntity = null; // Clear focus when manually moving camera
|
||||
}
|
||||
|
||||
// During drag
|
||||
|
Reference in New Issue
Block a user