public void ClearRegisterKey() { for (int i = 0; i < 4; i++) { CrossPlatformInputManager.UnRegisterVirtualAxis(hrztaxis_n + i); CrossPlatformInputManager.UnRegisterVirtualAxis(vtcaxis_n + i); HRZTAxis[i] = null; VTCAxis[i] = null; } for (int i = 0; i < 4; i++) { CrossPlatformInputManager.UnRegisterVirtualButton(nmatk_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(fr1_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(fr2_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(fr3_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(sk1_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(sk2_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(sk3_n + i); CrossPlatformInputManager.UnRegisterVirtualButton(trail_n + i); NMATK[i] = null; FR1[i] = null; FR2[i] = null; FR3[i] = null; SK1[i] = null; SK2[i] = null; SK3[i] = null; TRAIL[i] = null; } NetworkServer.Shutdown(); }
void CreateVirtualAxes() { // set axes to use m_UseX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); m_UseY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (m_UseX) { if (CrossPlatformInputManager.AxisExists(horizontalAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxisName); } m_HorizontalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(horizontalAxisName); CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis); } if (m_UseY) { if (CrossPlatformInputManager.AxisExists(verticalAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxisName); } m_VerticalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(verticalAxisName); CrossPlatformInputManager.RegisterVirtualAxis(m_VerticalVirtualAxis); } }
private void OnDisable() { if (CrossPlatformInputManager.AxisExists(horizontalAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxisName); } if (CrossPlatformInputManager.AxisExists(verticalAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxisName); } }
void OnDisable() { // Unsubscribe trigger events if (powerType == PowerType.Joystick) { PowerJoystick.OnJoyPosHTriggerButtonDown -= PosHTriggerButtonDown; PowerJoystick.OnJoyPosHTriggerButtonUp -= PosHTriggerButtonUp; PowerJoystick.OnJoyNegHTriggerButtonDown -= NegHTriggerButtonDown; PowerJoystick.OnJoyNegHTriggerButtonUp -= NegHTriggerButtonUp; PowerJoystick.OnJoyPosVTriggerButtonDown -= PosVTriggerButtonDown; PowerJoystick.OnJoyPosVTriggerButtonUp -= PosVTriggerButtonUp; PowerJoystick.OnJoyNegVTriggerButtonDown -= NegVTriggerButtonDown; PowerJoystick.OnJoyNegVTriggerButtonUp -= NegVTriggerButtonUp; } if (powerType == PowerType.DPad) { PowerDPad.OnDPadPosHTriggerButtonDown -= PosHTriggerButtonDown; PowerDPad.OnDPadPosHTriggerButtonUp -= PosHTriggerButtonUp; PowerDPad.OnDPadNegHTriggerButtonDown -= NegHTriggerButtonDown; PowerDPad.OnDPadNegHTriggerButtonUp -= NegHTriggerButtonUp; PowerDPad.OnDPadPosVTriggerButtonDown -= PosVTriggerButtonDown; PowerDPad.OnDPadPosVTriggerButtonUp -= PosVTriggerButtonUp; PowerDPad.OnDPadNegVTriggerButtonDown -= NegVTriggerButtonDown; PowerDPad.OnDPadNegVTriggerButtonUp -= NegVTriggerButtonUp; } // Unsubscribe normal button events if (powerType == PowerType.Button) { PowerButton.OnPowerButtonDown -= OnPowerButtonDown; PowerButton.OnPowerButtonUp -= OnPowerButtonUp; } // Unregister axis and button if (horizontalAxis != null && CrossPlatformInputManager.AxisExists(horizontalAxis.name)) { CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxis.name); } if (verticalAxis != null && CrossPlatformInputManager.AxisExists(verticalAxis.name)) { CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxis.name); } if (buttonAxis != null && CrossPlatformInputManager.AxisExists(buttonAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(buttonAxisName); } if (button != null && CrossPlatformInputManager.ButtonExists(button.name)) { CrossPlatformInputManager.UnRegisterVirtualButton(button.name); } }
// Start is called before the first frame update void Start() { if (CrossPlatformInputManager.AxisExists(this.horizontalAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(this.horizontalAxisName); } if (CrossPlatformInputManager.AxisExists(this.verticalsAxisName)) { CrossPlatformInputManager.UnRegisterVirtualAxis(this.verticalsAxisName); } this.HorizontalAxis = new CrossPlatformInputManager.VirtualAxis(this.horizontalAxisName); this.VerticalAxis = new CrossPlatformInputManager.VirtualAxis(this.verticalsAxisName); CrossPlatformInputManager.RegisterVirtualAxis(this.HorizontalAxis); CrossPlatformInputManager.RegisterVirtualAxis(this.VerticalAxis); }
public static void UnRegisterAxis(string name) { CrossPlatformInputManager.UnRegisterVirtualAxis(name); }
CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis; // Reference to the joystick in the cross platform input void OnEnable() { CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxisName); CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxisName); CreateVirtualAxes(); }
private void OnDestroy() { CrossPlatformInputManager.UnRegisterVirtualAxis("Horizontal"); CrossPlatformInputManager.UnRegisterVirtualButton("Jump"); }