2023-09-27 01:29:45 +00:00
|
|
|
using UnityEngine;
|
2023-10-18 02:36:56 +00:00
|
|
|
using UnityEngine.AI;
|
2023-09-27 01:29:45 +00:00
|
|
|
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
|
|
namespace BlueWaterProject
|
|
|
|
{
|
2023-09-27 05:30:06 +00:00
|
|
|
public class Npc : BaseCharacter
|
2023-09-27 01:29:45 +00:00
|
|
|
{
|
2023-10-18 02:36:56 +00:00
|
|
|
private NpcStateMachine stateMachine;
|
|
|
|
private NavMeshAgent agent;
|
|
|
|
|
|
|
|
public Transform[] usuallyPoints;
|
|
|
|
|
|
|
|
protected override void Start()
|
|
|
|
{
|
|
|
|
base.Start();
|
|
|
|
|
|
|
|
agent = GetComponent<NavMeshAgent>();
|
|
|
|
stateMachine = gameObject.AddComponent<NpcStateMachine>();
|
|
|
|
|
|
|
|
var usuallyPointState = new UsuallyPointState(agent, usuallyPoints);
|
|
|
|
stateMachine.ChangeState(usuallyPointState);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
stateMachine.Update();
|
|
|
|
|
|
|
|
// 필요하면 플레이어의 명령을 처리하는 로직을 추가
|
|
|
|
}
|
2023-09-27 01:29:45 +00:00
|
|
|
}
|
|
|
|
}
|