fix mouse actions
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user