/// <summary> /// Additional init, ensures that InputShell has instance allocated /// </summary> void Start() { inputShell = InputShell.Instance; // Shell control states don't need to generate events inputShell.ZoomVector.GenerateButtonEvents = false; inputShell.ScrollVector.GenerateButtonEvents = false; }
/// <summary> /// Maps input from sources and states to the shell input interface /// </summary> void ApplyInputToShell() { InputShell shell = inputShell; // Update select button bool selectButton = inputSwitchLogic.GetCurrentSelectPressed(); shell.SelectButton.ApplyState(selectButton); // Update menu button bool menuButton = inputSwitchLogic.GetAnyMenuPressed(); shell.MenuButton.ApplyState(menuButton); // Update the scroll vector shell.ScrollVector.AddState(inputSources.touch6D.touchState); if (inputSources.gamepad.IsActiveTargetingSource() && !inputSources.gamepad.JoystickDragging) { shell.ScrollVector.AddState(stateLeftJoyScroll); } shell.ScrollVector.AddState(stateTargetScroll); shell.ScrollVector.FinalizeState(); // Update the zoom vector shell.ZoomVector.AddState(stateHandZoom); shell.ZoomVector.AddState(stateSixDOFZoom); shell.ZoomVector.AddState(inputSources.editor.dragControl); shell.ZoomVector.AddState(stateMouseWheelZoom); shell.ZoomVector.AddState(stateTrigZoom); shell.ZoomVector.FinalizeState(); // Update the cardinal input vector shell.CardinalVector.AddState(stateLeftJoyCardinal); shell.CardinalVector.AddState(statePadCardinal); shell.CardinalVector.FinalizeState(); // Update targeting ray shell.TargetOrigin = inputSwitchLogic.GetTargetOrigin(); shell.TargetOrientation = inputSwitchLogic.GetTargetOrientation(); shell.TargetingReady = inputSwitchLogic.GetTargetingReady(); }