123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using CMF;
- using UnityEngine;
- using WS;
- [ObjectSystem]
- public class CursorManagerAwakeSystem : AwakeSystem<CursorManager>
- {
- public override void Awake(CursorManager self)
- {
- self.Awake();
- }
- }
- [ObjectSystem]
- public class CursorManagerUpdateSyste : UpdateSystem<CursorManager>
- {
- public override void Update(CursorManager self)
- {
- self.Update();
- }
- }
- public class CursorManager : SingleComponent<CursorManager>
- {
- public enum CursorState
- {
- Hide,
- HideAndMove,
- Show,
- ShowAndMove,
- }
- public CursorState cursorState;
- public CharacterKeyboardInput keyboardInput;
- public CameraController cameraController;
- public void Awake() { }
- public void Update() { }
- public void SetCursorState(CursorState state)
- {
- bool isControllerMove = false;
- switch (state)
- {
- case CursorState.Hide:
- Cursor.lockState = CursorLockMode.Locked;
- isControllerMove = false;
- break;
- case CursorState.HideAndMove:
- Cursor.lockState = CursorLockMode.Locked;
- isControllerMove = true;
- break;
- case CursorState.Show:
- Cursor.lockState = CursorLockMode.None;
- isControllerMove = false;
- break;
- case CursorState.ShowAndMove:
- Cursor.lockState = CursorLockMode.None;
- isControllerMove = true;
- break;
- }
- if (keyboardInput != null)
- {
- keyboardInput.useInput = isControllerMove;
- }
- if (cameraController != null)
- {
- cameraController.enabled = isControllerMove;
- }
- }
- }
|