// Update is called once per frame void Update() { //******Camera movement****** float camYVal = Input.GetAxis(camY); if (camYVal != 0) { //Debug.Log("camY "+ camYVal); } float camXVal = Input.GetAxis(camX); if (camXVal != 0) { //Debug.Log("camX "+ camXVal); } if (camYVal != 0 || camXVal != 0) { //cc.RotateCamera(camYVal, camXVal); } // ******Car movement****** verticalVal = Input.GetAxis(vertical); horizontalVal = Input.GetAxis(horizontal); //Steering if (HasTiltedHorizontal) { dc.Steer(horizontalVal); } else { dc.Steer(0); } if (!IsGrounded && (HasTiltedHorizontal || HasTiltedVertical)) { //Debug.Log("air steer"); dc.AerialSteer(horizontalVal, verticalVal); } //Accelerate if (Input.GetButton(accelerate) && IsGrounded) { //Debug.Log("Accelerate"); IsDriving = true; dc.Accelerate(1); } if (Input.GetButtonUp(accelerate)) { //Debug.Log("Accelerate"); dc.Accelerate(0); } //Reverse or Brake if (Input.GetButtonDown(reverse)) { if (IsDriving) { BrakeNotReverse = true; } else { BrakeNotReverse = false; } } if (Input.GetButton(reverse) && IsGrounded) { if (BrakeNotReverse) { //Debug.Log("Brake"); dc.Brake(1); } else { IsDriving = true; dc.Reverse(1); cc.ChangeCameraViewToReverse(); } } if (Input.GetButtonUp(reverse)) { dc.Brake(0); dc.Reverse(0); } //*****Abilities***** if (Input.GetButton(jump) && upgrades.boosterRocketsEnabled) { dc.Rocket(); } //*****Abilities***** if (Input.GetButtonDown(DebugReset)) { //Debug.Log("Jump"); dc.ResetRotation(); } if (Input.GetButton(nitro) && upgrades.nitroBoostersEnabled) { gb.nitroBoost(); } //Check States IsGrounded = dc.CheckWheelsGrounded(); HasJumped = !IsGrounded; HasTiltedHorizontal = SetStickBool(horizontalVal); HasTiltedVertical = SetStickBool(verticalVal); }