mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-18 13:58:28 +00:00
handbrake, backward, forward buttons done ?
This commit is contained in:
parent
64b0ab230c
commit
a21d835b47
1 changed files with 16 additions and 2 deletions
|
@ -128,7 +128,7 @@ namespace SanAndreasUnity.UI
|
|||
pedMovementInputGo.SetActive(false);
|
||||
vehicleInputGo.SetActive(true);
|
||||
|
||||
this.UpdateVehicleTurningInput();
|
||||
this.UpdateVehicleMovementInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -178,8 +178,10 @@ namespace SanAndreasUnity.UI
|
|||
this.UpdateMovementInput(movementButton, movementButton.GetMovement());
|
||||
}
|
||||
|
||||
void UpdateVehicleTurningInput()
|
||||
void UpdateVehicleMovementInput()
|
||||
{
|
||||
var customInput = CustomInput.Instance;
|
||||
|
||||
// obtain input from arrow button
|
||||
Vector2 input = turnVehicleButton.GetMovementPercentage();
|
||||
// ignore y axis
|
||||
|
@ -187,6 +189,13 @@ namespace SanAndreasUnity.UI
|
|||
// now input has only x value between -1 and 1
|
||||
|
||||
this.UpdateMovementInput(turnVehicleButton, input);
|
||||
|
||||
// get status of backward and forward buttons
|
||||
bool isBackwardOn = backwardVehiclePickup.IsPointerInside && backwardVehiclePickup.IsPointerDown;
|
||||
bool isForwardOn = forwardVehiclePickup.IsPointerInside && forwardVehiclePickup.IsPointerDown;
|
||||
if (isBackwardOn || isForwardOn)
|
||||
customInput.SetAxis("Vertical", isForwardOn ? 1.0f : -1.0f);
|
||||
|
||||
}
|
||||
|
||||
void UpdateMovementInput(ArrowsMovementButton arrowButton, Vector2 input)
|
||||
|
@ -232,6 +241,11 @@ namespace SanAndreasUnity.UI
|
|||
customInput.SetButton("Jump", isJumpOn);
|
||||
customInput.SetButton("LeftClick", isFireOn);
|
||||
|
||||
// get status of handbrake
|
||||
|
||||
bool isHandbrakeOn = handbrakePickup.IsPointerInside && handbrakePickup.IsPointerDown;
|
||||
customInput.SetButton("Brake", isHandbrakeOn);
|
||||
|
||||
// process click events
|
||||
|
||||
if (m_walkPressed)
|
||||
|
|
Loading…
Add table
Reference in a new issue