// Use this for initialization void OnEnable() { if (mapping.type == AxisMapping.MappingType.NamedAxis) { steerAxis = new CrossPlatformInput.VirtualAxis(mapping.axisName); } }
private void OnEnable() { if (this.mapping.type == TiltInput.AxisMapping.MappingType.NamedAxis) { this.steerAxis = new CrossPlatformInput.VirtualAxis(this.mapping.axisName); } }
private void OnEnable() { this.useX = (this.axesToUse == TouchJoystick.AxisOption.Both || this.axesToUse == TouchJoystick.AxisOption.OnlyHorizontal); this.useY = (this.axesToUse == TouchJoystick.AxisOption.Both || this.axesToUse == TouchJoystick.AxisOption.OnlyVertical); if (this.useX) { this.horizontalVirtualAxis = new CrossPlatformInput.VirtualAxis(this.horizontalAxisName); } if (this.useY) { this.verticalVirtualAxis = new CrossPlatformInput.VirtualAxis(this.verticalAxisName); } this.gui = base.GetComponent <GUITexture>(); if (this.gui != null) { this.defaultRect = this.gui.GetScreenRect(); } base.transform.position = new Vector3(0f, 0f, base.transform.position.z); this.moveStick = true; if (this.inputMode == TouchJoystick.InputMode.TouchPadPositional || this.inputMode == TouchJoystick.InputMode.TouchPadRelativePositional || this.inputMode == TouchJoystick.InputMode.TouchPadSwipe) { this.touchPad = true; this.getTouchZoneRect = true; if (this.gui == null) { this.moveStick = false; } else if (this.touchZone == null) { this.touchZone = this.gui; this.moveStick = false; } else { this.moveStick = true; } } else { this.touchPad = false; this.guiTouchOffset.x = this.defaultRect.width * 0.5f; this.guiTouchOffset.y = this.defaultRect.height * 0.5f; this.guiCenter.x = this.defaultRect.x + this.guiTouchOffset.x; this.guiCenter.y = this.defaultRect.y + this.guiTouchOffset.y; this.guiBoundary.min.x = this.defaultRect.x - this.guiTouchOffset.x; this.guiBoundary.max.x = this.defaultRect.x + this.guiTouchOffset.x; this.guiBoundary.min.y = this.defaultRect.y - this.guiTouchOffset.y; this.guiBoundary.max.y = this.defaultRect.y + this.guiTouchOffset.y; this.moveStick = true; } if (this.gui != null) { this.gui.pixelInset = this.defaultRect; base.transform.localScale = Vector3.zero; } }
void OnEnable() { // if the axis doesnt exist create a new one in cross platform input axis = CrossPlatformInput.VirtualAxisReference(axisName) ?? new CrossPlatformInput.VirtualAxis(axisName); // get the screen rect of the gui element rect = GetComponent<GUIElement>().GetScreenRect(); FindPairedButton(); }
private float axisCentre; // The centre of the axis void OnEnable() { // if the axis doesnt exist create a new one in cross platform input axis = CrossPlatformInput.VirtualAxisReference(axisName) ?? new CrossPlatformInput.VirtualAxis(axisName); // get the screen rect of the gui element rect = GetComponent <GUIElement>().GetScreenRect(); FindPairedButton(); }
private void CreateVirtualAxes() { this.useX = (this.axesToUse == JoystickAbstract.AxisOption.Both || this.axesToUse == JoystickAbstract.AxisOption.OnlyHorizontal); this.useY = (this.axesToUse == JoystickAbstract.AxisOption.Both || this.axesToUse == JoystickAbstract.AxisOption.OnlyVertical); if (this.useX) { this.horizontalVirtualAxis = new CrossPlatformInput.VirtualAxis(this.horizontalAxisName); } if (this.useY) { this.verticalVirtualAxis = new CrossPlatformInput.VirtualAxis(this.verticalAxisName); } }
public void RegisterVirtualAxis(CrossPlatformInput.VirtualAxis axis) { if (this.virtualAxes.ContainsKey(axis.name)) { Debug.LogError("There is already a virtual axis named " + axis.name + " registered."); } else { this.virtualAxes.Add(axis.name, axis); if (!axis.matchWithInputManager) { this.alwaysUseVirtual.Add(axis.name); } } }
private void CreateVirtualAxes() { // set axes to use useX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); useY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (useX) { horizontalVirtualAxis = new CrossPlatformInput.VirtualAxis(horizontalAxisName); } if (useY) { verticalVirtualAxis = new CrossPlatformInput.VirtualAxis(verticalAxisName); } }
public void RegisterVirtualAxis(CrossPlatformInput.VirtualAxis axis) { // check if we already have an axis with that name and log and error if we do if (virtualAxes.ContainsKey(axis.name)) { Debug.LogError("There is already a virtual axis named " + axis.name + " registered."); } else { // add any new axes virtualAxes.Add(axis.name, axis); // if we dont want to match with the input manager setting then revert to always using virtual if (!axis.matchWithInputManager) { alwaysUseVirtual.Add(axis.name); } } }
// Token: 0x06004DDA RID: 19930 RVA: 0x001A1803 File Offset: 0x0019FC03 private static void RegisterVirtualAxis(CrossPlatformInput.VirtualAxis axis) { CrossPlatformInput.virtualInput.RegisterVirtualAxis(axis); }
private void CreateVirtualAxes() { // set axes to use useX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); useY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (useX) horizontalVirtualAxis = new CrossPlatformInput.VirtualAxis(horizontalAxisName); if (useY) verticalVirtualAxis = new CrossPlatformInput.VirtualAxis(verticalAxisName); }
private void OnEnable() { // set axes to use useX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); useY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (useX) { horizontalVirtualAxis = new CrossPlatformInput.VirtualAxis(horizontalAxisName); } if (useY) { verticalVirtualAxis = new CrossPlatformInput.VirtualAxis(verticalAxisName); } // Cache this component at startup instead of looking up every frame gui = GetComponent<GUITexture>(); if (gui != null) { // Store the default rect for the gui, so we can snap back to it defaultRect = gui.GetScreenRect(); } transform.position = new Vector3(0.0f, 0.0f , transform.position.z); moveStick = true; if (inputMode == InputMode.TouchPadPositional || inputMode == InputMode.TouchPadRelativePositional || inputMode == InputMode.TouchPadSwipe) { touchPad = true; getTouchZoneRect = true; if (gui == null) { // no GUI on this object, so no stick to move moveStick = false; } else { if (touchZone == null) { // marked as a touchpad, but no touchzone gui assigned, so this object's // GUI is the touchzone, and no stick to move: touchZone = gui; moveStick = false; } else { // touchpad, plus we have GUI on this object and a separate touchzone, // so we do have a stick to move. moveStick = true; } } } else { touchPad = false; // This is an offset for touch input to match with the top left // corner of the GUI guiTouchOffset.x = defaultRect.width*0.5f; guiTouchOffset.y = defaultRect.height*0.5f; // Cache the center of the GUI, since it doesn't change guiCenter.x = defaultRect.x + guiTouchOffset.x; guiCenter.y = defaultRect.y + guiTouchOffset.y; // Let's build the GUI boundary, so we can clamp joystick movement guiBoundary.min.x = defaultRect.x - guiTouchOffset.x; guiBoundary.max.x = defaultRect.x + guiTouchOffset.x; guiBoundary.min.y = defaultRect.y - guiTouchOffset.y; guiBoundary.max.y = defaultRect.y + guiTouchOffset.y; moveStick = true; } if (gui != null) { gui.pixelInset = defaultRect; transform.localScale = Vector3.zero; } }
// Use this for initialization void OnEnable () { if (mapping.type == AxisMapping.MappingType.NamedAxis) { steerAxis = new CrossPlatformInput.VirtualAxis(mapping.axisName); } }
private void OnEnable() { // set axes to use useX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); useY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (useX) { horizontalVirtualAxis = new CrossPlatformInput.VirtualAxis(horizontalAxisName); } if (useY) { verticalVirtualAxis = new CrossPlatformInput.VirtualAxis(verticalAxisName); } // Cache this component at startup instead of looking up every frame gui = GetComponent <GUITexture>(); if (gui != null) { // Store the default rect for the gui, so we can snap back to it defaultRect = gui.GetScreenRect(); } transform.position = new Vector3(0.0f, 0.0f, transform.position.z); moveStick = true; if (inputMode == InputMode.TouchPadPositional || inputMode == InputMode.TouchPadRelativePositional || inputMode == InputMode.TouchPadSwipe) { touchPad = true; getTouchZoneRect = true; if (gui == null) { // no GUI on this object, so no stick to move moveStick = false; } else { if (touchZone == null) { // marked as a touchpad, but no touchzone gui assigned, so this object's // GUI is the touchzone, and no stick to move: touchZone = gui; moveStick = false; } else { // touchpad, plus we have GUI on this object and a separate touchzone, // so we do have a stick to move. moveStick = true; } } } else { touchPad = false; // This is an offset for touch input to match with the top left // corner of the GUI guiTouchOffset.x = defaultRect.width * 0.5f; guiTouchOffset.y = defaultRect.height * 0.5f; // Cache the center of the GUI, since it doesn't change guiCenter.x = defaultRect.x + guiTouchOffset.x; guiCenter.y = defaultRect.y + guiTouchOffset.y; // Let's build the GUI boundary, so we can clamp joystick movement guiBoundary.min.x = defaultRect.x - guiTouchOffset.x; guiBoundary.max.x = defaultRect.x + guiTouchOffset.x; guiBoundary.min.y = defaultRect.y - guiTouchOffset.y; guiBoundary.max.y = defaultRect.y + guiTouchOffset.y; moveStick = true; } if (gui != null) { gui.pixelInset = defaultRect; transform.localScale = Vector3.zero; } }
private void OnEnable() { this.axis = (CrossPlatformInput.VirtualAxisReference(this.axisName) ?? new CrossPlatformInput.VirtualAxis(this.axisName)); this.rect = base.GetComponent <GUIElement>().GetScreenRect(); this.FindPairedButton(); }