Hallucination system

This commit is contained in:
Ferlat Thibaud
2026-03-16 17:06:47 +01:00
parent 10faf74405
commit 0d968f75ab
44 changed files with 2860 additions and 909 deletions
@@ -222,36 +222,32 @@ namespace Unheimlich.World.CameraSystem
if (Mouse.current != null)
{
Vector2 mousePos = Mouse.current.position.ReadValue();
bool mouseHasMoved = Vector2.Distance(mousePos, _lastMousePosition) > 0.1f;
_lastMousePosition = mousePos;
if (mouseHasMoved)
float screenWidth = Screen.width;
float screenHeight = Screen.height;
float borderPixels = _edgeBorderSize * Mathf.Min(screenWidth, screenHeight);
if (mousePos.x >= 0f && mousePos.x < borderPixels)
{
float screenWidth = Screen.width;
float screenHeight = Screen.height;
float borderPixels = _edgeBorderSize * Mathf.Min(screenWidth, screenHeight);
if (mousePos.x < borderPixels)
{
panX = -(borderPixels - mousePos.x) / borderPixels;
hasInput = true;
}
else if (mousePos.x > screenWidth - borderPixels)
{
panX = (mousePos.x - (screenWidth - borderPixels)) / borderPixels;
hasInput = true;
}
if (mousePos.y < borderPixels)
{
panY = -(borderPixels - mousePos.y) / borderPixels;
hasInput = true;
}
else if (mousePos.y > screenHeight - borderPixels)
{
panY = (mousePos.y - (screenHeight - borderPixels)) / borderPixels;
hasInput = true;
}
panX = -(borderPixels - mousePos.x) / borderPixels;
hasInput = true;
}
else if (mousePos.x > screenWidth - borderPixels && mousePos.x <= screenWidth)
{
panX = (mousePos.x - (screenWidth - borderPixels)) / borderPixels;
hasInput = true;
}
if (mousePos.y >= 0f && mousePos.y < borderPixels)
{
panY = -(borderPixels - mousePos.y) / borderPixels;
hasInput = true;
}
else if (mousePos.y > screenHeight - borderPixels && mousePos.y <= screenHeight)
{
panY = (mousePos.y - (screenHeight - borderPixels)) / borderPixels;
hasInput = true;
}
}