PlayerLocomotionInput
Anonymous
plain_text
12/25/2024 10:15 AM
1.4 KB
30
Indexable
using Player.FinalCharacterController;
using UnityEngine;
using UnityEngine.InputSystem;
namespace Player.FinallCharacterController
{
public class PlayerLocomotionInput : MonoBehaviour, PlayerControls.IPlayerLocomotionMapActions
{
public PlayerControls PlayerControls { get; private set; }
public Vector2 MovementInput { get; private set; }
private void OnEnable()
{
PlayerControls = new PlayerControls();
PlayerControls.Enable();
PlayerControls.PlayerLocomotionMap.Enable();
PlayerControls.PlayerLocomotionMap.SetCallbacks(this);
}
private void OnDisable()
{
PlayerControls.PlayerLocomotionMap.Disable();
PlayerControls.PlayerLocomotionMap.RemoveCallbacks(this);
}
public void OnNewaction(InputAction.CallbackContext context)
{
MovementInput = context.ReadValue<Vector2>();
print(MovementInput);
}
}
}
Editor is loading...
Leave a Comment