using UnityEngine;
using UnityEngine.InputSystem; // Dodaliśmy to!

public class PlayerMove : MonoBehaviour
{
    public float speed = 5f;
    private CharacterController controller;

    void Start() => controller = GetComponent<CharacterController>();

    void Update()
    {
        // Nowy sposób pobierania WASD
        Vector2 moveInput = Vector2.zero;

        if (Keyboard.current != null)
        {
            if (Keyboard.current.wKey.isPressed) moveInput.y = 1;
            if (Keyboard.current.sKey.isPressed) moveInput.y = -1;
            if (Keyboard.current.aKey.isPressed) moveInput.x = -1;
            if (Keyboard.current.dKey.isPressed) moveInput.x = 1;
        }

        Vector3 move = transform.right * moveInput.x + transform.forward * moveInput.y;
        controller.Move(move * speed * Time.deltaTime);
    }
}