diff options
| author | SmallFox <2806143047@qq.com> | 2026-05-21 07:21:06 +0800 |
|---|---|---|
| committer | SmallFox <2806143047@qq.com> | 2026-05-21 07:21:06 +0800 |
| commit | 3dcf88a36c072e42005c48dae419c66996c96f84 (patch) | |
| tree | 76a068834f2f536d83d5f1702fa35de6554da8d0 /Assets/Scripts/InputHandler.cs | |
| parent | a60a3d9344118915a50f22567bef6bee3f2a2415 (diff) | |
摄像机视角实现
实现跟随自由旋转
Diffstat (limited to 'Assets/Scripts/InputHandler.cs')
| -rw-r--r-- | Assets/Scripts/InputHandler.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Assets/Scripts/InputHandler.cs b/Assets/Scripts/InputHandler.cs index ec72656..f653adb 100644 --- a/Assets/Scripts/InputHandler.cs +++ b/Assets/Scripts/InputHandler.cs @@ -14,10 +14,27 @@ namespace DS public float mouseY; private PlayerControls _inputActions; + private CameraHandler _cameraHandler; private Vector2 _movementInput; private Vector2 _cameraInput; + private void Awake() + { + _cameraHandler = CameraHandler.singleton; + } + + private void FixedUpdate() + { + float delta = Time.fixedDeltaTime; + + if (_cameraHandler != null) + { + _cameraHandler.FollowTarget(delta); + _cameraHandler.HandleCameraRotation(delta,mouseX,mouseY); + } + } + public void OnEnable() { if (_inputActions == null) @@ -48,6 +65,7 @@ namespace DS moveAmount = Mathf.Clamp01(Mathf.Abs((horizontal)) + Mathf.Abs(vertical)); mouseX = _cameraInput.x; mouseY = _cameraInput.y; + } } } |
