Initial commit

This commit is contained in:
2026-09-15 00:20:30 +09:00
commit 3b323714fd
2691 changed files with 118290 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
public class InputManager : MonoBehaviour, GameInput.ICharacterActions
{
// 외부에서 InputManager.Instance.OnXxx_Event += handler 형태로 구독.
public static InputManager Instance { get; private set; }
private GameInput _input;
public event Action OnMoveNext_Event;
private void Awake()
{
if (Instance == null)
{
Instance = this; //만들어진 자신을 인스턴스로 설정
}
else
{
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
}
_input = new GameInput();
_input.Character.SetCallbacks(this);
}
// GameInput은 활성/비활성 토글이 필요한 자원 ?. 처리로 Awake보다 OnEnable이 먼저 호출되는 경우 보호.
private void OnEnable() => _input?.Character.Enable();
private void OnDisable() => _input?.Character.Disable();
private void OnDestroy() => _input?.Dispose();
public void OnMove(InputAction.CallbackContext ctx)
{
if (ctx.phase == InputActionPhase.Performed)
OnMoveNext_Event?.Invoke();
}
}