void OnMove(Vector3 movement) { // incorpate our move speed _motor.Move(movement * _moveSpeed); if (Input.GetKey(KeyCode.LeftShift)) { _motor.Move(movement * _sprintSpeed); } else { _motor.Move(movement * _moveSpeed); } }
void OnMove(Vector3 movement) { if (IsPlaying == true) { // Debug.Log("Move: " + movement); motor.Move(movement * moveSpeed); if (moveSpeed == .1f) { if (AudioMovement.isPlaying == false || AudioMovement.clip == AudioSprint && AudioMovement.isPlaying == true) { if (AudioMovement.clip == AudioSprint) { AudioMovement.Stop(); } AudioMovement.clip = AudioWalk; AudioMovement.Play(); } } else { if (AudioMovement.isPlaying == false || AudioMovement.clip == AudioWalk && AudioMovement.isPlaying == true) { if (AudioMovement.clip == AudioWalk) { AudioMovement.Stop(); } AudioMovement.clip = AudioSprint; AudioMovement.Play(); } } } }
void Update() { //Calculate movement velocity as a 3D vector float _xMov = Input.GetAxis("Horizontal"); float _zMov = Input.GetAxis("Vertical"); Vector3 _movHorizontal = transform.right * _xMov; Vector3 _movVertical = transform.forward * _zMov; // Final movement vector Vector3 _velocity = (_movHorizontal + _movVertical).normalized; if (isGrounded) { motor.movementSpeed = walkingSpeed; } else { motor.movementSpeed = inAirSpeed; } if (Input.GetButton("Run")) { motor.movementSpeed = runningSpeed; } //Apply movement motor.Move(_velocity); //calculate rotation using mouse turning float _yRot = Input.GetAxis("Mouse X") * lookSensitivity; // Final rotate vector Vector3 _rotation = new Vector3(0, _yRot, 0); //Apply Rotation motor.Rotate(_rotation); //calculate rotation for camera turning rotationY += Input.GetAxis("Mouse Y") * lookSensitivity; rotationY = Mathf.Clamp(rotationY, -camYRotationLimit, camYRotationLimit); // Final rotate vector Vector3 _cameraRotation = new Vector3(-rotationY, motor.cam.transform.localEulerAngles.y, 0); //Apply Camera Rotation motor.RotateCamera(_cameraRotation); //jump if (Input.GetButton("Jump") && isGrounded && !PauseMenu.IsOn) { GetComponent <Rigidbody> ().AddForce(0, jumpVelocity, 0); } }
void OnMove(Vector3 movement) { //incorporate move speed _motor.Move(movement * _moveSpeed); }
private void OnMove(Vector3 movement) { _motor.Move(movement * _moveSpeed); }
private void OnMove(Vector3 movement) { motor.Move(movement * currentMoveSpeed); }
void OnMove(Vector3 movement) { //Debug.Log("Move: " + movement); _motor.Move(movement * _movementSpeed); }
void OnMove(Vector3 movement) { //movespeed _motor.Move(movement * _moveSpeed); Sprint(); }
void OnMove(Vector3 movement) { //run Move in Motor with movespeed defined in PlayerController _motor.Move(movement * _moveSpeed); }