/// <summary> /// Returns the requested buttonState /// </summary> /// <param name="button">Button that should be checked</param> /// <param name="controllerIndex">Controller that should be checked for the button state</param> /// <returns>VRIL_ButtonInteractionType</returns> public VRIL_ButtonInteractionType GetButtonState(VRIL_ButtonType button, GameObject controller) { switch (LoadedSdkName) { case VRIL_LoadedSdkNames.None: return(VRIL_ButtonInteractionType.None); case VRIL_LoadedSdkNames.OpenVR: if (OpenVR_Script != null) { return(OpenVR_Script.GetButtonState(button, controller)); } break; case VRIL_LoadedSdkNames.Oculus: if (Oculus_Script != null) { return(Oculus_Script.GetButtonState(button, controller)); } break; case VRIL_LoadedSdkNames.CustomSDK: if (CustomSDK_Script != null) { return(CustomSDK_Script.GetButtonState(button, controller)); } break; } // if no script is attached return(VRIL_ButtonInteractionType.None); }
public VRIL_ControllerActionEventArgs(int controllerIndex, VRIL_ButtonType buttonType, VRIL_ButtonInteractionType interactionType, float buttonPressStrength) { ControllerIndex = controllerIndex; ButtonType = buttonType; ButtonInteractionType = interactionType; ButtonPressStrength = buttonPressStrength; }
/// <summary> /// Check ButtonState of a <see cref="VRIL_ButtonType"/> for a specific controller /// </summary> /// <param name="button">Button that should be checked</param> /// <param name="controller">Controller that should be checked</param> /// <returns></returns> public virtual VRIL_ButtonInteractionType GetButtonState(VRIL_ButtonType button, GameObject controller) { if (Manager != null) { return(Manager.GetButtonState(button, controller)); } else { return(VRIL_ButtonInteractionType.None); } }
/// <summary> /// Notify manager with action event /// </summary> /// <param name="fromSource">Source input from SteamVR</param> /// <param name="vRIL_ButtonType">Specified VRIL ButtonType in Inspector</param> /// <param name="vRIL_ButtonInteractionType">Specified VRIL InteractionType in Inspector</param> public void NotifyControllerActionEvent(SteamVR_Input_Sources fromSource, VRIL_ButtonType vRIL_ButtonType, VRIL_ButtonInteractionType vRIL_ButtonInteractionType) { VRIL_ControllerActionEventArgs v = new VRIL_ControllerActionEventArgs { ButtonType = vRIL_ButtonType, ButtonInteractionType = vRIL_ButtonInteractionType }; if (fromSource == SteamVR_Input_Sources.LeftHand) { v.ControllerIndex = 0; } else if (fromSource == SteamVR_Input_Sources.RightHand) { v.ControllerIndex = 1; } manager.OnControllerAction(v); }
public abstract VRIL_ButtonInteractionType GetButtonState(VRIL_ButtonType button, GameObject controller);