보스 몬스터 Ai 관련 코드 틀 추가

This commit is contained in:
Mingu Kim
2025-09-03 21:16:42 +09:00
parent 5b48bad730
commit a7133a4aba
15 changed files with 162 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
using UnityEngine;
public class EnemyStateManager : MonoBehaviour
{
public IEnemyState CurrentState;
void Start()
{
TransitionToState(new EIdleState());
}
void Update()
{
CurrentState?.UpdateState(this); // ? = CurrentState가 null이 아닐때만 실행되는 null 조건 연산자
}
public void TransitionToState(IEnemyState newState)
{
CurrentState?.ExitState(this);
CurrentState = newState;
CurrentState.EnterState(this);
print($"[TransitionToState]에서 상태 변경 -> {newState}");
}
}