// Update is called once per frame void Update() { // Update joystick axis if (powerType == PowerType.Joystick) { if (horizontalAxis != null) { horizontalAxis.Update(powerJoystick.GetHorizontalAxisValue()); } if (verticalAxis != null) { verticalAxis.Update(powerJoystick.GetVerticalAxisValue()); } } // Update d-pad axis if (powerType == PowerType.DPad) { if (horizontalAxis != null) { horizontalAxis.Update(powerDPad.GetHorizontalAxisValue()); } if (verticalAxis != null) { verticalAxis.Update(powerDPad.GetVerticalAxisValue()); } } // Update button axis if (powerType == PowerType.Button) { if (buttonAxisName != null && CrossPlatformInputManager.AxisExists(buttonAxisName)) { if (powerButton.GetButtonState() == PowerButton.ButtonState.PRESSED) { buttonAxis.Update(powerButton.GetAxisValue()); } if (powerButton.GetButtonState() == PowerButton.ButtonState.RELEASED && !powerButton.IsNegativeAxis() && buttonAxis.GetValue > 0) { buttonAxis.Update(0); } if (powerButton.GetButtonState() == PowerButton.ButtonState.RELEASED && powerButton.IsNegativeAxis() && buttonAxis.GetValue < 0) { buttonAxis.Update(0); } } } }