OldBlueWater/BlueWater/Assets/02.Scripts/Character/Npc/Npc.cs

42 lines
1.0 KiB
C#
Raw Normal View History

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