TimelineImprovements
This commit is contained in:
1 parent
e312131725
commit
f927552adc
2211 files changed
+115416
-540944
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using Code.Infrastructure.Input;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Code.OfficeGame.BattleMode.CursorControl
|
||||
{
|
||||
public class BattleModeCursorController : IDisposable
|
||||
{
|
||||
private IInputService _inputService;
|
||||
|
||||
public BattleModeCursorController(IInputService inputService)
|
||||
{
|
||||
_inputService = inputService;
|
||||
|
||||
_inputService.BindActionPerformed((int) ActionMappings.BattleMode, (int) BattleModeActions.RightClick, EnableCursor);
|
||||
_inputService.BindActionCancelled((int) ActionMappings.BattleMode, (int) BattleModeActions.RightClick, DisableCursor);
|
||||
}
|
||||
|
||||
private void EnableCursor(InputAction.CallbackContext obj)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
}
|
||||
|
||||
private void DisableCursor(InputAction.CallbackContext obj)
|
||||
{
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_inputService.UnbindActionPerformed((int) ActionMappings.BattleMode, (int) BattleModeActions.RightClick, EnableCursor);
|
||||
_inputService.UnbindActionCancelled((int) ActionMappings.BattleMode, (int) BattleModeActions.RightClick, DisableCursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user