- Scripts 폴더 정리: - FlyCamera.cs → StreamingleControl/Camera/ - LiveLinkFaceReceiver.cs → StreamingleControl/MotionCapture/ - YBillboard.cs → StreamingleControl/Extensions/ - CameraControlSystem.cs, CameraInfoUI.cs → StreamingleControl/Camera/ - InputHandler.cs, rawkey.cs → StreamingleControl/Input/ - 중복 IController.cs 제거 - ResourcesData 정리: - Background/Prop → ResourcesData/Prop 이동 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
using UnityEngine;
|
|
|
|
public class InputHandler : MonoBehaviour
|
|
{
|
|
private Vector2 lastMousePosition;
|
|
private float lastScrollValue;
|
|
private bool isRightMouseHeld;
|
|
private bool isMiddleMouseHeld;
|
|
private bool isOrbitActive;
|
|
private bool isZoomActive;
|
|
|
|
// 카메라 컨트롤 시스템 참조
|
|
private CameraControlSystem cameraControlSystem;
|
|
|
|
private void Start()
|
|
{
|
|
// CameraControlSystem 찾기
|
|
cameraControlSystem = FindObjectOfType<CameraControlSystem>();
|
|
if (cameraControlSystem == null)
|
|
{
|
|
Debug.LogWarning("[InputHandler] CameraControlSystem을 찾을 수 없습니다.");
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
// 마우스 버튼 상태 업데이트
|
|
isRightMouseHeld = Input.GetMouseButton(1);
|
|
isMiddleMouseHeld = Input.GetMouseButton(2);
|
|
isOrbitActive = Input.GetKey(KeyCode.LeftAlt) && Input.GetMouseButton(0); // Alt + 좌클릭으로 궤도 회전
|
|
isZoomActive = Input.GetKey(KeyCode.LeftControl) && Input.GetMouseButton(0); // Ctrl + 좌클릭으로 줌
|
|
|
|
// 마우스 위치 업데이트
|
|
lastMousePosition = Input.mousePosition;
|
|
lastScrollValue = Input.mouseScrollDelta.y;
|
|
}
|
|
|
|
public bool IsRightMouseHeld() => isRightMouseHeld;
|
|
public bool IsMiddleMouseHeld() => isMiddleMouseHeld;
|
|
public bool IsOrbitActive() => isOrbitActive;
|
|
public bool IsZoomActive() => isZoomActive;
|
|
|
|
public Vector2 GetLookDelta()
|
|
{
|
|
return new Vector2(
|
|
Input.GetAxis("Mouse X"),
|
|
Input.GetAxis("Mouse Y")
|
|
);
|
|
}
|
|
|
|
public float GetZoomDelta()
|
|
{
|
|
return Input.mouseScrollDelta.y;
|
|
}
|
|
|
|
public Vector2 GetMousePosition()
|
|
{
|
|
return Input.mousePosition;
|
|
}
|
|
|
|
// 카메라 컨트롤 시스템 관련 메서드들
|
|
public CameraControlSystem GetCameraControlSystem()
|
|
{
|
|
return cameraControlSystem;
|
|
}
|
|
|
|
public bool IsFunctionKeyPressed(KeyCode keyCode)
|
|
{
|
|
return Input.GetKeyDown(keyCode);
|
|
}
|
|
} |