agent = GetComponent<NavMeshAgent>();//获得导航组件
一.巡逻
agent.speed = speed * 0.5f;//巡逻状态下速度为平时移动的一般
//判断当前巡逻距离是否超过初始巡逻范围
if(Vector3.Distance(wayPoint, transform.position) <= agent.stoppingDistance)
{
if(remainLookAtTime > 0)//等待时间大于0后继续巡逻
{
agent = GetComponent<NavMeshAgent>();//获得导航组件
一.巡逻
agent.speed = speed * 0.5f;//巡逻状态下速度为平时移动的一般
//判断当前巡逻距离是否超过初始巡逻范围
if(Vector3.Distance(wayPoint, transform.position) <= agent.stoppingDistance)
{
if(remainLookAtTime > 0)//等待时间大于0后继续巡逻
{