コード例 #1
0
 // Rotate just the "Overworld" game object
 private void rotatePlayer()
 {
     if (this.player != null)
     {
         int angle = PlayerMovementServices.computeRotation(UserInputs.goUp(), UserInputs.goRight(), UserInputs.goDown(), UserInputs.goLeft(),
                                                            this.useSemiCardinalMovements);
         if (angle >= 0)
         {
             this.player.transform.eulerAngles = new Vector3(0, angle, 0);
         }
     }
 }
コード例 #2
0
 // Move the entire "Player" game object ("Overworld" + "MainCamera")
 private void movePlayer()
 {
     if (this.controller != null)
     {
         Vector3 moveDirection = Vector3.zero;
         if (this.controller.isGrounded)
         {
             moveDirection = PlayerMovementServices.computeMove(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"),
                                                                this.useSemiCardinalMovements, this.speed);
         }
         moveDirection.y -= GRAVITY * Time.deltaTime;
         this.controller.Move(moveDirection * Time.deltaTime);
     }
 }