移动逻辑修改
This commit is contained in:
parent
b5df614e9c
commit
7e7c986885
@ -89,6 +89,7 @@ public class RecuseNpc : MonoBehaviour
|
|||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
// 继续处理NPC的状态和动画
|
// 继续处理NPC的状态和动画
|
||||||
switch (nstate)
|
switch (nstate)
|
||||||
{
|
{
|
||||||
@ -109,9 +110,9 @@ public class RecuseNpc : MonoBehaviour
|
|||||||
currentTarget = targetPoints[0]; // 获取当前的目标点
|
currentTarget = targetPoints[0]; // 获取当前的目标点
|
||||||
nstate = Npcstate.run;
|
nstate = Npcstate.run;
|
||||||
movebool = true;
|
movebool = true;
|
||||||
|
float dis = Vector3.Distance(this.transform.position, currentTarget);
|
||||||
// 判断是否到达目标点
|
// 判断是否到达目标点
|
||||||
if (movebool && navMeshAgent.remainingDistance <= navMeshAgent.stoppingDistance)
|
if (movebool && dis < 0.1)
|
||||||
{
|
{
|
||||||
Debug.Log("到达目标点");
|
Debug.Log("到达目标点");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user