// Update is called once per frame void Update() { playerBikeMovement.Turn(GetSensorDisplacement()); playerBikeMovement.Accelerate(acceleration); Lean(GetSensorRotation()); if (curLeanAngle != 0) { playerBikeMovement.LeanLeft(curLeanAngle / maxLeanAngle); } /* * if (Input.GetKey (KeyCode.W)) { * playerBikeMovement.Accelerate (); * } * if (Input.GetKey (KeyCode.S)) { * playerBikeMovement.Decelerate (); * } * //TURN * if (Input.GetKey (KeyCode.A)) { * RepresentBikeTurnLeft (); * } else if (Input.GetKey (KeyCode.D)) { * RepresentBikeTurnRight (); * } else { * RepresentBikeTurnReset (); * } * //TILT * if (Input.GetKey (KeyCode.Q)) { * RepresentBikeTiltLeft (); * } else if (Input.GetKey (KeyCode.E)) { * RepresentBikeTiltRight (); * } * if (curLeanAngle > 0) { * playerBikeMovement.LeanLeft (curLeanAngle/maxLeanAngle); * } else if (curLeanAngle < 0) { * playerBikeMovement.LeanRight (-curLeanAngle/maxLeanAngle); * }*/ }
// Update is called once per frame void Update() { playerBikeMovement.Turn(Input.GetAxis("Horizontal")); playerBikeMovement.Accelerate(Input.GetAxis("Vertical")); Lean(Input.GetAxis("Lean")); if (curLeanAngle != 0) { playerBikeMovement.LeanLeft(curLeanAngle / maxLeanAngle); } /* * if (Input.GetKey (KeyCode.W)) { * playerBikeMovement.Accelerate (); * } * if (Input.GetKey (KeyCode.S)) { * playerBikeMovement.Decelerate (); * } * //TURN * if (Input.GetKey (KeyCode.A)) { * RepresentBikeTurnLeft (); * } else if (Input.GetKey (KeyCode.D)) { * RepresentBikeTurnRight (); * } else { * RepresentBikeTurnReset (); * } * //TILT * if (Input.GetKey (KeyCode.Q)) { * RepresentBikeTiltLeft (); * } else if (Input.GetKey (KeyCode.E)) { * RepresentBikeTiltRight (); * } * if (curLeanAngle > 0) { * playerBikeMovement.LeanLeft (curLeanAngle/maxLeanAngle); * } else if (curLeanAngle < 0) { * playerBikeMovement.LeanRight (-curLeanAngle/maxLeanAngle); * }*/ }