using Sirenix.OdinInspector; using UnityEngine; using UnityEngine.InputSystem; // ReSharper disable once CheckNamespace namespace BlueWaterProject { public class CombatInput : MonoBehaviour { [Required] public PlayerInput playerInput; public delegate void MoveInput(Vector2 movementInput); public event MoveInput OnMoveInputReceived; public delegate void DashInput(); public event DashInput OnDashInputReceived; public delegate void AttackInput(InputAction.CallbackContext context); public event AttackInput OnAttackInputReceived; private void OnEnable() { playerInput.actions.FindAction("Attack").performed += OnAttackEvent; } private void OnDisable() { playerInput.actions.FindAction("Attack").performed -= OnAttackEvent; } [Button("셋팅 초기화")] private void InitSetting() { playerInput = GetComponent(); } private void OnMove(InputValue value) { var movementInput = value.Get(); OnMoveInputReceived?.Invoke(movementInput); } private void OnDash() { OnDashInputReceived?.Invoke(); } private void OnAttackEvent(InputAction.CallbackContext context) { OnAttackInputReceived?.Invoke(context); } private void OnItemInventory() { var activeSelf = UiManager.Inst.CombatUi.CombatItemInventoryUi.gameObject.activeSelf; UiManager.Inst.CombatUi.CombatItemInventoryUi.SetActiveInventoryUi(!activeSelf); } private void OnEsc() { if (UiManager.Inst.CombatUi.CombatItemInventoryUi.gameObject.activeSelf) { UiManager.Inst.CombatUi.CombatItemInventoryUi.SetActiveInventoryUi(false); } } } }