fix mouse actions
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -44,7 +44,6 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
private void OnDisable()
|
||||
{
|
||||
_gameMouseHandler.Dispose();
|
||||
_inputSystem.Disable();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -54,7 +54,7 @@ public class RadialMenuItem : MonoBehaviour
|
||||
|
||||
public void CancelAndClose()
|
||||
{
|
||||
tcs.TrySetCanceled();
|
||||
tcs.TrySetResult(RadialMenuActions.Cancel);
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user