using System.Collections; using System.Collections.Generic; using System.Linq; using System; using UnityEngine; using UnityEngine.InputSystem; public class PlayerInput : MonoBehaviour { [SerializeField] private int playerNumber; public Vector2 movement; public Vector2 look; public Gamepad controller { get; private set; } public bool whipAttack; public event Action ropeLengthShrinken; public event Action ropeLengthExtend; public bool useArrowKeys = false; public int PlayerNum => playerNumber; private void Start() { controller = Gamepad.all.ElementAtOrDefault(playerNumber); if (controller == null) { Debug.LogWarning($"No Gamepad found for player {playerNumber + 1}"); } } private void Update() { movement.x = Input.GetAxisRaw("bruh"); movement.y = Input.GetAxisRaw("bruh_v"); whipAttack = Input.GetKey(KeyCode.R); if (Input.GetKey(KeyCode.E)) ropeLengthShrinken?.Invoke(playerNumber); if (Input.GetKey(KeyCode.Q)) ropeLengthExtend?.Invoke(playerNumber); } }