캐릭터 움직임

This commit is contained in:
2026-09-24 00:30:35 +09:00
parent 3b323714fd
commit ac2828c0ed
75 changed files with 1680 additions and 72 deletions

View File

@@ -9,6 +9,7 @@ private void Awake()
if (Instance == null)
{
Instance = this; //만들어진 자신을 인스턴스로 설정
DontDestroyOnLoad(gameObject); //씬이 바뀌어도 파괴되지 않도록 설정
}
else
{

View File

@@ -9,13 +9,14 @@ public class InputManager : MonoBehaviour, GameInput.ICharacterActions
private GameInput _input;
public event Action OnMoveNext_Event;
public event Action<Vector2> OnMove_Event;
private void Awake()
{
if (Instance == null)
{
Instance = this; //만들어진 자신을 인스턴스로 설정
DontDestroyOnLoad(gameObject); //씬이 바뀌어도 파괴되지 않도록 설정
}
else
{
@@ -33,7 +34,9 @@ private void Awake()
public void OnMove(InputAction.CallbackContext ctx)
{
if (ctx.phase == InputActionPhase.Performed)
OnMoveNext_Event?.Invoke();
// Performed만 받으면 키를 뗐을 때(Canceled) 0이 전달되지 않아 계속 움직인다.
// Canceled의 ReadValue는 Vector2.zero를 돌려준다.
if (ctx.phase == InputActionPhase.Performed || ctx.phase == InputActionPhase.Canceled)
OnMove_Event?.Invoke(ctx.ReadValue<Vector2>());
}
}

View File

@@ -14,6 +14,7 @@ private void Awake()
if (Instance == null)
{
Instance = this; // 만들어진 자신을 인스턴스로 설정
DontDestroyOnLoad(gameObject); //씬이 바뀌어도 파괴되지 않도록 설정
}
else
{

View File

@@ -32,6 +32,7 @@ private void Awake()
if (Instance == null)
{
Instance = this; //만들어진 자신을 인스턴스로 설정
DontDestroyOnLoad(gameObject); //씬이 바뀌어도 파괴되지 않도록 설정
Initialize();
}
else