Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CalculateMovement()
- {
- float horizontalInput = Input.GetAxis("Mouse X");
- float verticalInput = Input.GetAxis("Mouse Y");
- Cursor.lockState = CursorLockMode.Locked;
- Vector3 direction = (new Vector3(horizontalInput, verticalInput, 0));
- transform.Translate(direction * _speed * Time.deltaTime);
- if (Input.GetAxisRaw("Mouse X") == 0)
- {
- _anim.SetBool("PlayerCenter", true);
- _anim.SetBool("PlayerRight", false);
- _anim.SetBool("PlayerLeft", false);
- }
- else if (Input.GetAxisRaw("Mouse X") >= 0.1)
- {
- _anim.SetBool("PlayerRight", true);
- _anim.SetBool("PlayerCenter", false);
- _anim.SetBool("PlayerLeft", false);
- }
- else if (Input.GetAxisRaw("Mouse X") <= -0.1)
- {
- _anim.SetBool("PlayerLeft", true);
- _anim.SetBool("PlayerRight", false);
- _anim.SetBool("PlayerCenter", false);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement