fix mouse actions

This commit is contained in:
Vova
2024-05-23 12:27:21 +03:00
parent 83430199d3
commit fc1ea41818
8 changed files with 23 additions and 56 deletions
+1 -1
View File
@@ -2451,7 +2451,7 @@ MonoBehaviour:
m_OverrideVoxelSize: 1
m_VoxelSize: 0.3
m_MinRegionArea: 1
m_NavMeshData: {fileID: 23800000, guid: a0cdc9a92c4bac44cbd576f9c5bfb78a, type: 2}
m_NavMeshData: {fileID: 23800000, guid: 3ce2e5aab30f1724e85beabcb1680e85, type: 2}
m_BuildHeightMesh: 1
--- !u!4 &464115413
Transform:
-1
View File
@@ -44,7 +44,6 @@ public class GameManager : MonoBehaviour
}
private void OnDisable()
{
_gameMouseHandler.Dispose();
_inputSystem.Disable();
}
+3 -12
View File
@@ -14,8 +14,6 @@ public class InGameMouseHandler : UnityEngine.Object
private Camera _camera;
private BaseInteractableObject _selectedObject;
private bool _pressControl = false;
private bool _mousePress = false;
public InGameMouseHandler(Camera camera)
{
@@ -26,17 +24,11 @@ public class InGameMouseHandler : UnityEngine.Object
var waypointPrefab = Resources.Load("WayPointSign", typeof(WaypointVisual)) as WaypointVisual;
_waypointVisual = Instantiate(waypointPrefab, GameManager.Instance.transform);
GameManager.Instance.Input.PlayerAction.PointClick.performed += ClickToMove;
}
public void Dispose()
private void ClickToMove(bool isClickOnGui)
{
GameManager.Instance.Input.PlayerAction.PointClick.performed += ClickToMove;
}
private void ClickToMove(InputAction.CallbackContext context)
{
if (!_pressControl)
if (isClickOnGui)
{
GameManager.Instance.UI.ClosePopupMenu();
@@ -55,14 +47,13 @@ public class InGameMouseHandler : UnityEngine.Object
}
}
}
_pressControl = false;
}
public void Update()
{
if (Mouse.current.leftButton.wasPressedThisFrame)
{
_pressControl = !EventSystem.current.IsPointerOverGameObject();
ClickToMove(!EventSystem.current.IsPointerOverGameObject());
}
_ray = _camera.ScreenPointToRay(Mouse.current.position.ReadValue());
if (Physics.Raycast(_ray, out var mouseRaycastHit, 100f, _selectableLayerMask))
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.8.1
// version 1.8.2
// from Assets/Scripts/Managers/InputSystem/InputActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
+1 -1
View File
@@ -54,7 +54,7 @@ public class RadialMenuItem : MonoBehaviour
public void CancelAndClose()
{
tcs.TrySetCanceled();
tcs.TrySetResult(RadialMenuActions.Cancel);
Close();
}
+15 -36
View File
@@ -60,14 +60,13 @@
"url": "https://packages.unity.com"
},
"com.unity.collections": {
"version": "2.4.0",
"depth": 2,
"version": "1.4.0",
"depth": 3,
"source": "registry",
"dependencies": {
"com.unity.burst": "1.8.12",
"com.unity.burst": "1.6.6",
"com.unity.nuget.mono-cecil": "1.11.4",
"com.unity.test-framework": "1.4.3",
"com.unity.test-framework.performance": "3.0.3"
"com.unity.test-framework": "1.1.31"
},
"url": "https://packages.unity.com"
},
@@ -107,7 +106,7 @@
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.3.1",
"version": "1.2.6",
"depth": 1,
"source": "registry",
"dependencies": {},
@@ -115,19 +114,18 @@
},
"com.unity.nuget.mono-cecil": {
"version": "1.11.4",
"depth": 3,
"depth": 4,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.render-pipelines.core": {
"version": "17.0.3",
"version": "16.0.6",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.mathematics": "1.2.6",
"com.unity.mathematics": "1.2.4",
"com.unity.ugui": "2.0.0",
"com.unity.collections": "2.2.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.terrain": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
@@ -141,27 +139,18 @@
"dependencies": {
"com.unity.mathematics": "1.2.1",
"com.unity.burst": "1.8.9",
"com.unity.render-pipelines.core": "17.0.3",
"com.unity.shadergraph": "17.0.3",
"com.unity.render-pipelines.universal-config": "17.0.3"
}
},
"com.unity.render-pipelines.universal-config": {
"version": "17.0.3",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.render-pipelines.core": "17.0.3"
"com.unity.render-pipelines.core": "16.0.6",
"com.unity.shadergraph": "16.0.6"
}
},
"com.unity.rendering.light-transport": {
"version": "1.0.1",
"version": "1.0.2",
"depth": 2,
"source": "builtin",
"dependencies": {
"com.unity.collections": "2.2.0",
"com.unity.collections": "1.4.0",
"com.unity.mathematics": "1.2.4",
"com.unity.modules.terrain": "1.0.0"
"com.unity.render-pipelines.core": "16.0.1"
}
},
"com.unity.searcher": {
@@ -172,11 +161,11 @@
"url": "https://packages.unity.com"
},
"com.unity.shadergraph": {
"version": "17.0.3",
"version": "16.0.6",
"depth": 1,
"source": "builtin",
"dependencies": {
"com.unity.render-pipelines.core": "17.0.3",
"com.unity.render-pipelines.core": "16.0.6",
"com.unity.searcher": "4.9.2"
}
},
@@ -191,16 +180,6 @@
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework.performance": {
"version": "3.0.3",
"depth": 3,
"source": "registry",
"dependencies": {
"com.unity.test-framework": "1.1.31",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.8.6",
"depth": 0,
+2 -2
View File
@@ -1,2 +1,2 @@
m_EditorVersion: 6000.0.0f1
m_EditorVersionWithRevision: 6000.0.0f1 (4ff56b3ea44c)
m_EditorVersion: 2023.2.20f1
m_EditorVersionWithRevision: 2023.2.20f1 (0e25a174756c)
@@ -12,7 +12,5 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: de02f9e1d18f588468e474319d09a723, type: 3}
m_Name:
m_EditorClassIdentifier:
shaderVariantLimit: 128
customInterpolatorErrorThreshold: 32
customInterpolatorWarningThreshold: 16
customHeatmapValues: {fileID: 0}