using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace ronald
{
public class inputhandler : MonoBehaviour
{
public float horizontal;
public float vertical;
public float moveAmount;
public float mousex;
public float mousey;
PlayerControls inputactions;
Vector2 movementInput;
Vector2 camerainput;
public void onenable()
{
if (inputactions == null)
{
inputactions = new PlayerControls();
inputactions.playermovement.movement.preformed += inputactions => movementInput = inputactions.ReadValue();
inputactions.playermovement.camera.preformed += i => camerainput = i.readvalue();
}
inputactions.enable();
}
private void OnDisable()
{
inputactions.Disable();
}
public void tickinput(float delta)
{
moveinput(delta);
}
private void moveinput(float delta)
{
horizontal = movementInput.x;
vertical = movementInput.y;
moveamount = mathf.clamp01(mathf.abs(horizontal) + mathf.abs(vertical));
mousex = camerainput.x;
mousey = camerainput.y;
}
}
}