Snapshot before project reorganization

This commit is contained in:
2026-02-12 16:28:36 +01:00
parent 8758d6eaeb
commit 9b7bb2aa62
27 changed files with 1864 additions and 119 deletions
@@ -2,6 +2,8 @@ using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using Unheimlich.Gameplay.DetectiveBoard;
using System.Collections.Generic;
using UnityEngine.EventSystems;
namespace Unheimlich.UI.DetectiveBoard
{
@@ -20,7 +22,8 @@ namespace Unheimlich.UI.DetectiveBoard
[SerializeField] private DetectiveBoardController _boardController;
[Header("Settings")]
[SerializeField] private float _maxInteractionDistance = 5f;
[SerializeField] private float _minInteractionDistance = 0.1f;
[SerializeField] private float _maxInteractionDistance = 10f;
private DetectiveBoardCanvas _canvasManager;
private PostItNode _hoveredNode;
@@ -253,26 +256,20 @@ namespace Unheimlich.UI.DetectiveBoard
private PostItNode RaycastForNode()
{
if (_camera == null)
if (_camera == null || Mouse.current == null)
return null;
Vector2 mousePos = Mouse.current.position.ReadValue();
Ray ray = _camera.ScreenPointToRay(new Vector3(mousePos.x, mousePos.y, 0));
if (Physics.Raycast(ray, out RaycastHit hit, _maxInteractionDistance, _boardLayer))
GraphicRaycaster raycaster = _boardCanvas?.GetComponent<GraphicRaycaster>();
if (raycaster != null && EventSystem.current != null)
{
return hit.collider.GetComponentInParent<PostItNode>();
}
GraphicRaycaster raycaster = _boardCanvas.GetComponent<GraphicRaycaster>();
if (raycaster != null)
{
var pointerEventData = new UnityEngine.EventSystems.PointerEventData(UnityEngine.EventSystems.EventSystem.current)
var pointerEventData = new PointerEventData(EventSystem.current)
{
position = mousePos
};
var results = new System.Collections.Generic.List<UnityEngine.EventSystems.RaycastResult>();
var results = new List<RaycastResult>();
raycaster.Raycast(pointerEventData, results);
foreach (var result in results)
@@ -283,6 +280,17 @@ namespace Unheimlich.UI.DetectiveBoard
}
}
Ray ray = _camera.ScreenPointToRay(new Vector3(mousePos.x, mousePos.y, 0));
if (Physics.Raycast(ray, out RaycastHit hit, _maxInteractionDistance, _boardLayer))
{
float distance = hit.distance;
if (distance >= _minInteractionDistance)
{
return hit.collider.GetComponentInParent<PostItNode>();
}
}
return null;
}
}