42 lines
1.0 KiB
C#
42 lines
1.0 KiB
C#
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace BlueWaterProject
|
|
{
|
|
public class Npc : BaseCharacter
|
|
{
|
|
private NpcStateMachine stateMachine;
|
|
private NavMeshAgent agent;
|
|
private Transform visaualLook;
|
|
|
|
public Transform[] usuallyPoints;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
visaualLook = transform.Find("UnitRoot");
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
agent = GetComponent<NavMeshAgent>();
|
|
stateMachine = gameObject.AddComponent<NpcStateMachine>();
|
|
|
|
var usuallyPointState = new UsuallyPointState(agent, usuallyPoints, visaualLook);
|
|
stateMachine.ChangeState(usuallyPointState);
|
|
}
|
|
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
stateMachine.Update();
|
|
|
|
// 필요하면 플레이어의 명령을 처리하는 로직을 추가
|
|
}
|
|
|
|
|
|
}
|
|
} |