DI
This commit is contained in:
@@ -21,14 +21,19 @@ namespace RebootKit.FPPKit {
|
||||
public InputActionReference PrimaryActionReference;
|
||||
public InputActionReference SecondaryActionReference;
|
||||
}
|
||||
|
||||
[CVar("fpp_cam_look_sens", 0.25f)]
|
||||
private CVar _sensitivityCVar;
|
||||
|
||||
[CVar("p_move_speed", 4.0f)]
|
||||
private CVar _movementSpeedCVar;
|
||||
|
||||
[Inject]
|
||||
private InputService _inputService;
|
||||
|
||||
private Config _config;
|
||||
|
||||
private FPPActor _player;
|
||||
|
||||
private CVar _sensitivityCVar;
|
||||
private CVar _movementSpeedCVar;
|
||||
|
||||
public PlayerController(Config config) {
|
||||
_config = config;
|
||||
}
|
||||
@@ -37,8 +42,8 @@ namespace RebootKit.FPPKit {
|
||||
}
|
||||
|
||||
public async UniTask OnStart(CancellationToken cancellationToken) {
|
||||
RR.Service<InputService>().LockCursor();
|
||||
RR.Service<InputService>().EnableControls();
|
||||
_inputService.LockCursor();
|
||||
_inputService.EnableControls();
|
||||
|
||||
_sensitivityCVar = RR.CVarNumber("fpp_cam_look_sens", 0.25f);
|
||||
_movementSpeedCVar = RR.CVarNumber("p_move_speed", 4.0f);
|
||||
@@ -49,8 +54,8 @@ namespace RebootKit.FPPKit {
|
||||
}
|
||||
|
||||
public void OnStop() {
|
||||
RR.Service<InputService>().DisableControls();
|
||||
RR.Service<InputService>().UnlockCursor();
|
||||
_inputService.DisableControls();
|
||||
_inputService.UnlockCursor();
|
||||
Object.Destroy(_player);
|
||||
|
||||
RR.World().KillActor(_player);
|
||||
|
||||
Reference in New Issue
Block a user