-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCursorState.cs
More file actions
34 lines (30 loc) · 1.02 KB
/
CursorState.cs
File metadata and controls
34 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CursorState : MonoBehaviour
{
public enum CursorStates {Free_Show,Free_NotShow, Locked_Show, Locked_NotShow }
[SerializeField] private CursorStates _CursorState;
void Start()
{
switch(_CursorState)
{
case CursorStates.Free_Show:
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
break;
case CursorStates.Free_NotShow:
Cursor.lockState = CursorLockMode.None;
Cursor.visible = false;
break;
case CursorStates.Locked_Show:
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = true;
break;
case CursorStates.Locked_NotShow:
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
break;
}
}
}