19 lines
572 B
C#
19 lines
572 B
C#
using UnityEngine;
|
|
|
|
namespace GazeLab.InputSystem
|
|
{
|
|
public sealed class MouseAimInput : MonoBehaviour, IAimInputSource
|
|
{
|
|
public AimControlMode ControlMode => AimControlMode.Mouse;
|
|
|
|
public bool TryGetScreenPosition(out Vector2 screenPixelPosition)
|
|
{
|
|
Vector3 mousePos = UnityEngine.Input.mousePosition;
|
|
screenPixelPosition = new Vector2(mousePos.x, mousePos.y);
|
|
return mousePos.x >= 0f && mousePos.x <= Screen.width &&
|
|
mousePos.y >= 0f && mousePos.y <= Screen.height;
|
|
}
|
|
}
|
|
}
|
|
|