Team-Futurity / Futurity

청강문화산업대학교 3학년 졸업 작품 프로젝트
0 stars 5 forks source link

Input 시스템 수정 #159

Closed Budy123 closed 1 year ago

Budy123 commented 1 year ago

사용법

InputActionManager

[컴포넌트 이미지]

ToggleActionMap

DisableActionMap

RegisterCallback

RemoveCallback

이외 예시가 필요하면 수정된 코드 확인. 참고로 InputActionMap마다 Callback을 등록하고 삭제할 때 다음 구조를 권장함.

// PlayerInputManager.cs
private void OnEnable()
{
    InputActionManager.Instance.RegisterCallback(InputActionManager.Instance.InputActions.Player.Move, OnMove);
    InputActionManager.Instance.RegisterCallback(InputActionManager.Instance.InputActions.Player.Dash, OnDash);
    InputActionManager.Instance.RegisterCallback(InputActionManager.Instance.InputActions.Player.BasicAttack, OnNormalAttack);
    InputActionManager.Instance.RegisterCallback(InputActionManager.Instance.InputActions.Player.SpecialAttack, OnSpecialAttack);
    InputActionManager.Instance.RegisterCallback(InputActionManager.Instance.InputActions.Player.ActiveSkill, OnSpecialMove);
}

private void OnDisable()
{
    if(InputActionManager.Instance == null) { return; }

    InputActionManager.Instance.RemoveCallback(InputActionManager.Instance.InputActions.Player.Move, OnMove);
    InputActionManager.Instance.RemoveCallback(InputActionManager.Instance.InputActions.Player.Dash, OnDash);
    InputActionManager.Instance.RemoveCallback(InputActionManager.Instance.InputActions.Player.BasicAttack, OnNormalAttack);
    InputActionManager.Instance.RemoveCallback(InputActionManager.Instance.InputActions.Player.SpecialAttack, OnSpecialAttack);
    InputActionManager.Instance.RemoveCallback(InputActionManager.Instance.InputActions.Player.ActiveSkill, OnSpecialMove);
}