43 lines
840 B
C#
43 lines
840 B
C#
using UnityEngine;
|
|
|
|
public class CursorLock : MonoBehaviour
|
|
{
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Alpha1))
|
|
{
|
|
Cursor.visible = true;
|
|
Cursor.lockState = CursorLockMode.None;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Alpha2))
|
|
{
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Alpha3))
|
|
{
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Confined;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Alpha7))
|
|
{
|
|
Cursor.lockState = CursorLockMode.None;
|
|
Cursor.visible = true;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Alpha8))
|
|
{
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
Cursor.visible = false;
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Alpha9))
|
|
{
|
|
Cursor.lockState = CursorLockMode.Confined;
|
|
Cursor.visible = false;
|
|
}
|
|
}
|
|
}
|