43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace ActionRPG.Input
|
||
|
|
{
|
||
|
|
[RequireComponent(typeof(PlayerInputReader))]
|
||
|
|
public class PlayerInputTester : MonoBehaviour
|
||
|
|
{
|
||
|
|
private PlayerInputReader _input;
|
||
|
|
|
||
|
|
private void Awake()
|
||
|
|
{
|
||
|
|
_input = GetComponent<PlayerInputReader>();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnEnable()
|
||
|
|
{
|
||
|
|
_input.OnAttackPerformed += HandleAttack;
|
||
|
|
_input.OnKickPerformed += HandleKick;
|
||
|
|
_input.OnBlockStarted += HandleBlockStart;
|
||
|
|
_input.OnBlockCanceled += HandleBlockEnd;
|
||
|
|
_input.OnInteractPerformed += HandleInteract;
|
||
|
|
_input.OnJumpPerformed += HandleJump;
|
||
|
|
}
|
||
|
|
|
||
|
|
private void OnDisable()
|
||
|
|
{
|
||
|
|
_input.OnAttackPerformed -= HandleAttack;
|
||
|
|
_input.OnKickPerformed -= HandleKick;
|
||
|
|
_input.OnBlockStarted -= HandleBlockStart;
|
||
|
|
_input.OnBlockCanceled -= HandleBlockEnd;
|
||
|
|
_input.OnInteractPerformed -= HandleInteract;
|
||
|
|
_input.OnJumpPerformed -= HandleJump;
|
||
|
|
}
|
||
|
|
|
||
|
|
private void HandleAttack() => Debug.Log("Attack");
|
||
|
|
private void HandleKick() => Debug.Log("Kick");
|
||
|
|
private void HandleBlockStart() => Debug.Log("Block Start");
|
||
|
|
private void HandleBlockEnd() => Debug.Log("Block End");
|
||
|
|
private void HandleInteract() => Debug.Log("Interact");
|
||
|
|
private void HandleJump() => Debug.Log("Jump");
|
||
|
|
}
|
||
|
|
}
|