public void Initialize(Unity.Entities.World space) { controllerSystem = space.GetOrCreateSystem <ControllerSystem>(); playerControllerSystem = space.GetOrCreateSystem <PlayerInputSystem>(); playerSkillsSystem = space.GetOrCreateSystem <PlayerSkillsSystem>(); AddSystemToUpdateList(controllerSystem); AddSystemToUpdateList(playerControllerSystem); AddSystemToUpdateList(playerSkillsSystem); playerSpawnSystem = space.GetOrCreateSystem <PlayerSpawnSystem>(); AddSystemToUpdateList(playerSpawnSystem); cursorStateSystem = space.GetOrCreateSystem <CursorStateSystem>(); AddSystemToUpdateList(cursorStateSystem); gameUISystem = space.GetOrCreateSystem <GameUISystem>(); AddSystemToUpdateList(gameUISystem); playerInteractSystem = space.GetOrCreateSystem <PlayerInteractSystem>(); AddSystemToUpdateList(playerInteractSystem); }
protected override void OnUpdate() { Entities.WithAll <Controller>().ForEach((Entity e, ref Controller controller) => { if (controller.deviceID != 0) { if (controller.inputType == ((byte)DeviceType.Gamepad)) { foreach (Gamepad pad in Gamepad.all) { if (controller.deviceID == pad.deviceId) { controller.Value = ExtractGamepad(pad); } } } else if (controller.inputType == ((byte)DeviceType.KeyboardMouse)) { //foreach (Keyboard keyboard in Keyboard.all) CheckKeyboard(ref controller, PlayerSpawnSystem.GetKeyboard(controller.deviceID)); } } }); }