public AxisHandler GetWithName(string name) { AxisHandler axis = null; axies.ForEach((x) => { if (x.name() == name) { axis = x; } }); if (axis == null) { throw new System.NullReferenceException(); } return(axis); }
// Unbind Axis internal static void UnbindAxis(string m_Name, AxisHandler m_Handler) { foreach (AxisData aData in AxesDB) { if (aData.name == m_Name) { if (aData.axisHandler == m_Handler) { aData.axisHandler -= m_Handler; aData.useIt = (aData.axisHandler != null); } return; } } Debug.LogError("Axis " + m_Name + " Not Found."); }
private void Start() { InputController.Instance.RegisterHandler(new DragHandler("MiddleMouse", (handler, x) => { handler.IgnoreUI = false; }, (handler, mousePosition, delta) => { if (Camera.main.transform.position != transform.position) { transform.position = Camera.main.transform.position; } transform.position -= delta; handler.LastMousePosition = mousePosition - delta; }, (handler, point) => { handler.IgnoreUI = true; })); var zoomHandler = new AxisHandler("Mouse ScrollWheel", (handler, delta) => { GetComponent <Cinemachine.CinemachineVirtualCamera>().m_Lens.OrthographicSize += delta * -2; }, false); InputController.Instance.RegisterHandler(zoomHandler); }
/// <summary>Stops executing the function setup by the corresponding AddListener</summary> /// <param name="functionToStopCalling">The local function that you've setup to receive update events</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void RemoveOnAxisListener(AxisHandler functionToStopCalling, SteamVR_Input_Sources inputSource) { sourceMap[inputSource].onAxis -= functionToStopCalling; }
/// <summary>Executes a function when the float value of the action is non-zero.</summary> /// <param name="functionToCall">A local function that receives the boolean action who's state has changed, the corresponding input source, and the new value</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void AddOnAxisListener(AxisHandler functionToCall, SteamVR_Input_Sources inputSource) { sourceMap[inputSource].onAxis += functionToCall; }
protected void UnRegisterAxisHandler(AxisHandler handler) { _axisHandlers.Remove(handler); }
// Axis protected void RegisterAxisHandler(AxisHandler handler) { _axisHandlers.Add(handler); }
// Unbind Axis public static void UnbindAxis(string m_Name, AxisHandler m_Handler) { InputSettings.UnbindAxis(m_Name, m_Handler); }