30 lines
655 B
C#
30 lines
655 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class PlayerMovement : MonoBehaviour
|
|
{
|
|
private InputControls _controls;
|
|
private Vector2 _input;
|
|
|
|
[SerializeField] private float speed;
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
_controls = new InputControls();
|
|
_controls.Enable();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
_input = _controls.Player.Move.ReadValue<Vector2>();
|
|
Debug.Log(_input);
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
transform.Translate(_input.normalized * speed);
|
|
}
|
|
}
|