This commit is contained in:
LeeJaeHyun 2024-09-12 16:46:01 +09:00
parent 1c6282b65a
commit 7e4194be49

View File

@ -25,8 +25,10 @@ public class MonsterController : MonoBehaviour
{ {
playerTr = GameObject.Find("Player").GetComponent<Transform>(); playerTr = GameObject.Find("Player").GetComponent<Transform>();
monsterTr = transform; monsterTr = transform;
agent = GetComponent<NavMeshAgent>();
StartCoroutine(CheckMonsterState()); StartCoroutine(CheckMonsterState());
StartCoroutine(MonsterAction());
} }
IEnumerator CheckMonsterState() IEnumerator CheckMonsterState()
@ -63,6 +65,9 @@ public class MonsterController : MonoBehaviour
break; break;
case State.TRACE: case State.TRACE:
// 추적 시작
agent.SetDestination(playerTr.position);
agent.isStopped = false;
break; break;
case State.ATTACK: case State.ATTACK: