From 7e7c9868854e9978bb7c28401449bb317e73c5db Mon Sep 17 00:00:00 2001 From: huyulong <1838407198@qq.com> Date: Fri, 13 Dec 2024 19:17:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=80=BB=E8=BE=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaofang/Assets/Script/npc/RecuseNpc.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xiaofang/Assets/Script/npc/RecuseNpc.cs b/xiaofang/Assets/Script/npc/RecuseNpc.cs index 1da2ce81..d064d27a 100644 --- a/xiaofang/Assets/Script/npc/RecuseNpc.cs +++ b/xiaofang/Assets/Script/npc/RecuseNpc.cs @@ -89,6 +89,7 @@ public class RecuseNpc : MonoBehaviour private void Update() { + // 继续处理NPC的状态和动画 switch (nstate) { @@ -109,9 +110,9 @@ public class RecuseNpc : MonoBehaviour currentTarget = targetPoints[0]; // 获取当前的目标点 nstate = Npcstate.run; movebool = true; - + float dis = Vector3.Distance(this.transform.position, currentTarget); // 判断是否到达目标点 - if (movebool && navMeshAgent.remainingDistance <= navMeshAgent.stoppingDistance) + if (movebool && dis < 0.1) { Debug.Log("到达目标点");