BLOODJOE/Assets/Scripts/PlayerMovement.cs

29 lines
628 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>();
}
private void FixedUpdate()
{
transform.Translate(_input.normalized * speed);
}
}