fix new input mouse system
This commit is contained in:
@@ -1383,9 +1383,9 @@ RectTransform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 349281313}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 250, y: -90}
|
||||
m_SizeDelta: {x: 480, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &249161732
|
||||
|
||||
@@ -55,19 +55,8 @@ public class CameraSystem : MonoBehaviour
|
||||
private void Start()
|
||||
{
|
||||
transform.position = Player.Instance.transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
InputManager.Instance.CameraAction.Rotate.performed += OnCameraRotate;
|
||||
InputManager.Instance.CameraAction.Zoom.performed += OnCameraZoom;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
InputManager.Instance.CameraAction.Rotate.performed -= OnCameraRotate;
|
||||
InputManager.Instance.CameraAction.Zoom.performed -= OnCameraZoom;
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
@@ -79,14 +68,21 @@ public class CameraSystem : MonoBehaviour
|
||||
HandleCameraMovement(cameraMove);
|
||||
}
|
||||
|
||||
//float rotate = InputManager.Instance.CameraAction.Rotate.ReadValue<float>();
|
||||
//if (rotate != 0)
|
||||
//{
|
||||
//HandleCameraRotation(rotate, _rotateSpeed);
|
||||
//}
|
||||
float rotateDir = InputManager.Instance.CameraAction.Rotate.ReadValue<Vector2>().x;
|
||||
if (rotateDir != 0)
|
||||
{
|
||||
HandleCameraRotation(rotateDir, _rotateSpeed);
|
||||
}
|
||||
|
||||
float zoomAmount = InputManager.Instance.CameraAction.Zoom.ReadValue<Vector2>().y;
|
||||
if (zoomAmount != 0)
|
||||
{
|
||||
HandleCameraZoom_MoveY(zoomAmount);
|
||||
}
|
||||
//HandleCameraZoom_MoveY();
|
||||
//HandleCameraZoom_FOV();
|
||||
//HandleCameraZoom_MoveForward();
|
||||
//HandleCameraZoom_MoveY();
|
||||
|
||||
}
|
||||
|
||||
private void HandleCameraZoom_MoveForward()
|
||||
@@ -108,10 +104,8 @@ public class CameraSystem : MonoBehaviour
|
||||
_cinemachineTransposer.m_FollowOffset = _followOffset;
|
||||
}
|
||||
|
||||
private void OnCameraZoom(InputAction.CallbackContext context)
|
||||
private void HandleCameraZoom_MoveY(float _zoomAmount)
|
||||
{
|
||||
float _zoomAmount = InputManager.Instance.CameraAction.Rotate.ReadValue<Vector2>().y;
|
||||
|
||||
_followOffset.y += _zoomAmount;
|
||||
|
||||
_followOffset.y = Mathf.Clamp(_followOffset.y, _followOffsetMinY, _followOffsetMaxY);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class InGameMouseHandler : MonoBehaviour
|
||||
{
|
||||
@@ -49,7 +50,7 @@ public class InGameMouseHandler : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
var ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||
if(EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -70,7 +70,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
""id"": ""d269ae49-9dbe-4e7c-9a80-1276e29898d8"",
|
||||
""expectedControlType"": ""Vector2"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""interactions"": ""Hold"",
|
||||
""initialStateCheck"": true
|
||||
},
|
||||
{
|
||||
@@ -166,7 +166,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
""id"": ""23cd5caa-3052-46e5-b888-9b7097cffc1b"",
|
||||
""path"": ""<Mouse>/delta"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""processors"": ""NormalizeVector2"",
|
||||
""groups"": """",
|
||||
""action"": ""Rotate"",
|
||||
""isComposite"": false,
|
||||
@@ -186,7 +186,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
{
|
||||
""name"": ""left"",
|
||||
""id"": ""70123c0f-2726-4ff5-9a04-83d845177032"",
|
||||
""path"": ""<Keyboard>/q"",
|
||||
""path"": ""<Keyboard>/e"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
@@ -197,7 +197,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
{
|
||||
""name"": ""right"",
|
||||
""id"": ""81380d14-07da-4e3e-b74d-13a4bc2edc1d"",
|
||||
""path"": ""<Keyboard>/e"",
|
||||
""path"": ""<Keyboard>/q"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
@@ -210,7 +210,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
|
||||
""id"": ""8e2aefc6-bf10-4653-8782-6b92d5efc35a"",
|
||||
""path"": ""<Mouse>/scroll"",
|
||||
""interactions"": """",
|
||||
""processors"": ""NormalizeVector2"",
|
||||
""processors"": ""NormalizeVector2,InvertVector2(invertX=false)"",
|
||||
""groups"": """",
|
||||
""action"": ""Zoom"",
|
||||
""isComposite"": false,
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
"id": "d269ae49-9dbe-4e7c-9a80-1276e29898d8",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"interactions": "Hold",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
@@ -144,7 +144,7 @@
|
||||
"id": "23cd5caa-3052-46e5-b888-9b7097cffc1b",
|
||||
"path": "<Mouse>/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"processors": "NormalizeVector2",
|
||||
"groups": "",
|
||||
"action": "Rotate",
|
||||
"isComposite": false,
|
||||
@@ -164,7 +164,7 @@
|
||||
{
|
||||
"name": "left",
|
||||
"id": "70123c0f-2726-4ff5-9a04-83d845177032",
|
||||
"path": "<Keyboard>/q",
|
||||
"path": "<Keyboard>/e",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
@@ -175,7 +175,7 @@
|
||||
{
|
||||
"name": "right",
|
||||
"id": "81380d14-07da-4e3e-b74d-13a4bc2edc1d",
|
||||
"path": "<Keyboard>/e",
|
||||
"path": "<Keyboard>/q",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
@@ -188,7 +188,7 @@
|
||||
"id": "8e2aefc6-bf10-4653-8782-6b92d5efc35a",
|
||||
"path": "<Mouse>/scroll",
|
||||
"interactions": "",
|
||||
"processors": "NormalizeVector2",
|
||||
"processors": "NormalizeVector2,InvertVector2(invertX=false)",
|
||||
"groups": "",
|
||||
"action": "Zoom",
|
||||
"isComposite": false,
|
||||
|
||||
Reference in New Issue
Block a user