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);
|
||||
|
||||
20
Runtime/FPPKit/RebootKit.FPPKit.asmdef
Normal file
20
Runtime/FPPKit/RebootKit.FPPKit.asmdef
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "RebootKit.FPPKit",
|
||||
"rootNamespace": "RebootKit.FPPKit",
|
||||
"references": [
|
||||
"GUID:284059c7949783646b281a1b815580e6",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4",
|
||||
"GUID:9e24947de15b9834991c9d8411ea37cf"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Runtime/FPPKit/RebootKit.FPPKit.asmdef.meta
Normal file
7
Runtime/FPPKit/RebootKit.FPPKit.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d76b28af993d614f825cb34f438930f
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user