Example #1
0
 void CmdTurnPlayer(bool left)
 {
     if (bikeMovement != null)
     {
         bikeMovement.Turn(left);
     }
 }
Example #2
0
    private void TurnIfWall(Collider other, bool dodgeEntering)
    {
        if (!enabled)
        {
            return;
        }
        WallCollision wallCollision = other.GetComponent <WallCollision>();

        if (wallCollision == null)
        {
            return;
        }
        if (wallCollision.KillOnEnter() == dodgeEntering)
        {
            bool turnLeft = Random.Range(0, 2) == 0;
            playerMovement.Turn(turnLeft);
        }
    }
Example #3
0
    // 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);
         *      }*/
    }