2025-02-09 13:49:39 -05:00
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.InputSystem;
|
|
|
|
|
|
|
|
|
|
[RequireComponent(typeof(PlayerInput))]
|
|
|
|
|
public class Block : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public bool blocking = false;
|
2025-02-09 17:18:51 -05:00
|
|
|
private InputActionAsset actions;
|
2025-02-09 13:49:39 -05:00
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
actions = GetComponent<PlayerInput>().actions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
2025-02-09 17:18:51 -05:00
|
|
|
InputAction blockAction = actions.FindAction("Block");
|
2025-02-09 13:49:39 -05:00
|
|
|
|
|
|
|
|
if (blockAction.ReadValue<float>() == 1f)
|
|
|
|
|
{
|
2025-02-09 17:18:51 -05:00
|
|
|
blocking = true;
|
2025-02-09 13:49:39 -05:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-02-09 17:18:51 -05:00
|
|
|
blocking = false;
|
2025-02-09 13:49:39 -05:00
|
|
|
}
|
|
|
|
|
|
2025-02-09 17:18:51 -05:00
|
|
|
GetComponent<AnimationPlayer>().block = blocking;
|
2025-02-09 13:49:39 -05:00
|
|
|
}
|
|
|
|
|
}
|