This commit is contained in:
Vova
2023-12-10 19:32:12 +02:00
parent 1a114c10da
commit 72a210f142
4 changed files with 96 additions and 122 deletions
+3 -3
View File
@@ -1385,7 +1385,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 250, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 480, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &249161732
@@ -3404,7 +3404,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 749553635}
serializedVersion: 2
m_LocalRotation: {x: 0.26693356, y: -0.000000028720944, z: 0.00000000795524, w: 0.96371496}
m_LocalRotation: {x: 0.2669336, y: -3.4238033e-15, z: 1.836517e-15, w: 0.96371496}
m_LocalPosition: {x: 29.11, y: 3, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -3798,7 +3798,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 835327588}
serializedVersion: 2
m_LocalRotation: {x: 0.26693356, y: -0.000000028720944, z: 0.00000000795524, w: 0.96371496}
m_LocalRotation: {x: 0.2669336, y: -3.4238033e-15, z: 1.836517e-15, w: 0.96371496}
m_LocalPosition: {x: 29.11, y: 3, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
+13 -11
View File
@@ -59,13 +59,13 @@ public class CameraSystem : MonoBehaviour
private void OnEnable()
{
InputManager.Instance.CameraAction.MouseRotate.performed += OnCameraRotate;
InputManager.Instance.CameraAction.Rotate.performed += OnCameraRotate;
InputManager.Instance.CameraAction.Zoom.performed += OnCameraZoom;
}
private void OnDisable()
{
InputManager.Instance.CameraAction.MouseRotate.performed -= OnCameraRotate;
InputManager.Instance.CameraAction.Rotate.performed -= OnCameraRotate;
InputManager.Instance.CameraAction.Zoom.performed -= OnCameraZoom;
}
@@ -79,11 +79,11 @@ public class CameraSystem : MonoBehaviour
HandleCameraMovement(cameraMove);
}
float rotate = InputManager.Instance.CameraAction.Rotate.ReadValue<float>();
if (rotate != 0)
{
HandleCameraRotation(rotate, _rotateSpeed);
}
//float rotate = InputManager.Instance.CameraAction.Rotate.ReadValue<float>();
//if (rotate != 0)
//{
//HandleCameraRotation(rotate, _rotateSpeed);
//}
//HandleCameraZoom_FOV();
//HandleCameraZoom_MoveForward();
//HandleCameraZoom_MoveY();
@@ -110,7 +110,7 @@ public class CameraSystem : MonoBehaviour
private void OnCameraZoom(InputAction.CallbackContext context)
{
float _zoomAmount = InputManager.Instance.CameraAction.Rotate.ReadValue<float>();
float _zoomAmount = InputManager.Instance.CameraAction.Rotate.ReadValue<Vector2>().y;
_followOffset.y += _zoomAmount;
@@ -186,11 +186,13 @@ public class CameraSystem : MonoBehaviour
private void OnCameraRotate(InputAction.CallbackContext context)
{
if (!_useMouseRotate && !Mouse.current.middleButton.isPressed)
if (Mouse.current.middleButton.isPressed)
{
return;
}
HandleCameraRotation(Mouse.current.delta.x.value, _mouseRotationSpeed);
float rotateDir = InputManager.Instance.CameraAction.Rotate.ReadValue<Vector2>().x;
//HandleCameraRotation(rotationValue, _mouseRotationSpeed);
transform.eulerAngles += new Vector3(0, rotateDir * _rotateSpeed * Time.deltaTime, 0);
}
private void HandleCameraRotation(float rotateDir, float speed)
@@ -68,7 +68,7 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""name"": ""Rotate"",
""type"": ""Value"",
""id"": ""d269ae49-9dbe-4e7c-9a80-1276e29898d8"",
""expectedControlType"": ""Axis"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
@@ -77,19 +77,10 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""name"": ""Zoom"",
""type"": ""Value"",
""id"": ""41d86dbc-39e0-4655-bc19-0eab9d5014a6"",
""expectedControlType"": ""Axis"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""MouseRotate"",
""type"": ""Button"",
""id"": ""646b1fc6-f255-4d12-927e-de1a93611e1b"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -149,9 +140,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""isPartOfComposite"": true
},
{
""name"": ""1D Axis"",
""id"": ""4c934323-993d-4354-8897-20bcd2f9dddc"",
""path"": ""1DAxis"",
""name"": ""One Modifier"",
""id"": ""921968f3-646e-4a34-ae14-f68c8034a225"",
""path"": ""OneModifier"",
""interactions"": """",
""processors"": """",
""groups"": """",
@@ -160,9 +151,9 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""isPartOfComposite"": false
},
{
""name"": ""Negative"",
""id"": ""6f9e4496-b244-4667-8720-9096c41e3b4a"",
""path"": ""<Keyboard>/e"",
""name"": ""modifier"",
""id"": ""36967647-01b0-4446-99ec-8467c5282970"",
""path"": ""<Mouse>/middleButton"",
""interactions"": """",
""processors"": """",
""groups"": """",
@@ -171,8 +162,30 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""isPartOfComposite"": true
},
{
""name"": ""Positive"",
""id"": ""a89182c9-b935-4450-94e4-6d630806f6cc"",
""name"": ""binding"",
""id"": ""23cd5caa-3052-46e5-b888-9b7097cffc1b"",
""path"": ""<Mouse>/delta"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""2D Vector"",
""id"": ""1a1f22ab-5004-4133-844c-f3fd67792699"",
""path"": ""2DVector"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Rotate"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""left"",
""id"": ""70123c0f-2726-4ff5-9a04-83d845177032"",
""path"": ""<Keyboard>/q"",
""interactions"": """",
""processors"": """",
@@ -182,46 +195,24 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
""isPartOfComposite"": true
},
{
""name"": ""1D Axis"",
""id"": ""c813ebc8-78b7-4e4d-8340-564c7231e367"",
""path"": ""1DAxis"",
""name"": ""right"",
""id"": ""81380d14-07da-4e3e-b74d-13a4bc2edc1d"",
""path"": ""<Keyboard>/e"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Zoom"",
""isComposite"": true,
""isPartOfComposite"": false
},
{
""name"": ""negative"",
""id"": ""6bc3cbff-c850-49b7-bb63-6d49712aa2b7"",
""path"": ""<Mouse>/scroll/down"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Zoom"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": ""positive"",
""id"": ""d1a58c3b-b104-4c55-ab6f-faaf03b9b5c5"",
""path"": ""<Mouse>/scroll/up"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Zoom"",
""action"": ""Rotate"",
""isComposite"": false,
""isPartOfComposite"": true
},
{
""name"": """",
""id"": ""e84dc7e3-3c1e-4bb9-af62-e3ef4261fbbc"",
""path"": ""<Mouse>/middleButton"",
""id"": ""8e2aefc6-bf10-4653-8782-6b92d5efc35a"",
""path"": ""<Mouse>/scroll"",
""interactions"": """",
""processors"": """",
""processors"": ""NormalizeVector2"",
""groups"": """",
""action"": ""MouseRotate"",
""action"": ""Zoom"",
""isComposite"": false,
""isPartOfComposite"": false
}
@@ -238,7 +229,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
m_Camera_Move = m_Camera.FindAction("Move", throwIfNotFound: true);
m_Camera_Rotate = m_Camera.FindAction("Rotate", throwIfNotFound: true);
m_Camera_Zoom = m_Camera.FindAction("Zoom", throwIfNotFound: true);
m_Camera_MouseRotate = m_Camera.FindAction("MouseRotate", throwIfNotFound: true);
}
public void Dispose()
@@ -349,7 +339,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
private readonly InputAction m_Camera_Move;
private readonly InputAction m_Camera_Rotate;
private readonly InputAction m_Camera_Zoom;
private readonly InputAction m_Camera_MouseRotate;
public struct CameraActions
{
private @InputActions m_Wrapper;
@@ -357,7 +346,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
public InputAction @Move => m_Wrapper.m_Camera_Move;
public InputAction @Rotate => m_Wrapper.m_Camera_Rotate;
public InputAction @Zoom => m_Wrapper.m_Camera_Zoom;
public InputAction @MouseRotate => m_Wrapper.m_Camera_MouseRotate;
public InputActionMap Get() { return m_Wrapper.m_Camera; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -376,9 +364,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Zoom.started += instance.OnZoom;
@Zoom.performed += instance.OnZoom;
@Zoom.canceled += instance.OnZoom;
@MouseRotate.started += instance.OnMouseRotate;
@MouseRotate.performed += instance.OnMouseRotate;
@MouseRotate.canceled += instance.OnMouseRotate;
}
private void UnregisterCallbacks(ICameraActions instance)
@@ -392,9 +377,6 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
@Zoom.started -= instance.OnZoom;
@Zoom.performed -= instance.OnZoom;
@Zoom.canceled -= instance.OnZoom;
@MouseRotate.started -= instance.OnMouseRotate;
@MouseRotate.performed -= instance.OnMouseRotate;
@MouseRotate.canceled -= instance.OnMouseRotate;
}
public void RemoveCallbacks(ICameraActions instance)
@@ -421,6 +403,5 @@ public partial class @InputActions: IInputActionCollection2, IDisposable
void OnMove(InputAction.CallbackContext context);
void OnRotate(InputAction.CallbackContext context);
void OnZoom(InputAction.CallbackContext context);
void OnMouseRotate(InputAction.CallbackContext context);
}
}
@@ -46,7 +46,7 @@
"name": "Rotate",
"type": "Value",
"id": "d269ae49-9dbe-4e7c-9a80-1276e29898d8",
"expectedControlType": "Axis",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
@@ -55,19 +55,10 @@
"name": "Zoom",
"type": "Value",
"id": "41d86dbc-39e0-4655-bc19-0eab9d5014a6",
"expectedControlType": "Axis",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "MouseRotate",
"type": "Button",
"id": "646b1fc6-f255-4d12-927e-de1a93611e1b",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -127,9 +118,9 @@
"isPartOfComposite": true
},
{
"name": "1D Axis",
"id": "4c934323-993d-4354-8897-20bcd2f9dddc",
"path": "1DAxis",
"name": "One Modifier",
"id": "921968f3-646e-4a34-ae14-f68c8034a225",
"path": "OneModifier",
"interactions": "",
"processors": "",
"groups": "",
@@ -138,9 +129,9 @@
"isPartOfComposite": false
},
{
"name": "Negative",
"id": "6f9e4496-b244-4667-8720-9096c41e3b4a",
"path": "<Keyboard>/e",
"name": "modifier",
"id": "36967647-01b0-4446-99ec-8467c5282970",
"path": "<Mouse>/middleButton",
"interactions": "",
"processors": "",
"groups": "",
@@ -149,8 +140,30 @@
"isPartOfComposite": true
},
{
"name": "Positive",
"id": "a89182c9-b935-4450-94e4-6d630806f6cc",
"name": "binding",
"id": "23cd5caa-3052-46e5-b888-9b7097cffc1b",
"path": "<Mouse>/delta",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "2D Vector",
"id": "1a1f22ab-5004-4133-844c-f3fd67792699",
"path": "2DVector",
"interactions": "",
"processors": "",
"groups": "",
"action": "Rotate",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "left",
"id": "70123c0f-2726-4ff5-9a04-83d845177032",
"path": "<Keyboard>/q",
"interactions": "",
"processors": "",
@@ -160,46 +173,24 @@
"isPartOfComposite": true
},
{
"name": "1D Axis",
"id": "c813ebc8-78b7-4e4d-8340-564c7231e367",
"path": "1DAxis",
"name": "right",
"id": "81380d14-07da-4e3e-b74d-13a4bc2edc1d",
"path": "<Keyboard>/e",
"interactions": "",
"processors": "",
"groups": "",
"action": "Zoom",
"isComposite": true,
"isPartOfComposite": false
},
{
"name": "negative",
"id": "6bc3cbff-c850-49b7-bb63-6d49712aa2b7",
"path": "<Mouse>/scroll/down",
"interactions": "",
"processors": "",
"groups": "",
"action": "Zoom",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "positive",
"id": "d1a58c3b-b104-4c55-ab6f-faaf03b9b5c5",
"path": "<Mouse>/scroll/up",
"interactions": "",
"processors": "",
"groups": "",
"action": "Zoom",
"action": "Rotate",
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "e84dc7e3-3c1e-4bb9-af62-e3ef4261fbbc",
"path": "<Mouse>/middleButton",
"id": "8e2aefc6-bf10-4653-8782-6b92d5efc35a",
"path": "<Mouse>/scroll",
"interactions": "",
"processors": "",
"processors": "NormalizeVector2",
"groups": "",
"action": "MouseRotate",
"action": "Zoom",
"isComposite": false,
"isPartOfComposite": false
}