Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.InputSystem;
- [RequireComponent(typeof(Rigidbody))]
- public class BasicInputSystem: MonoBehaviour
- {
- // -- Animation --//
- public Animator animator;
- //-- Input Variables --//
- private PlayerInput playerInput;// third person player input clone
- private MyInputActionControls myInputActions;//this comes from creating playerInput Script
- // Start is called before the first frame update
- void Start()
- {
- PlayerInputSetup();
- }
- //==== Input Sytem ====//
- public void PlayerInputSetup()
- {
- playerInput = GetComponent<PlayerInput>();
- myInputActions = new MyInputActionControls();
- myInputActions.Player.Enable();
- }
- // Update is called once per frame
- void Update()
- {
- PlayerMove();
- }
- //==== Player Move ====//
- public void PlayerMove()
- {
- PlayerMovementInputVector = myInputActions.Player.Move.ReadValue<Vector2>();
- moveX = PlayerMovementInputVector.x * Time.deltaTime * 110.0f;// _input.move.x
- moveZ = PlayerMovementInputVector.y * Time.deltaTime * playerMoveSpeed;//_input.move.y
- transform.Translate(0, 0, moveZ);
- transform.Rotate(0, moveX, 0);
- if (isLocalPlayer)
- {
- animator.SetFloat("Speed", PlayerMovementInputVector.y);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement