npc寻路
This commit is contained in:
parent
31eb5af6d7
commit
f07db0d476
@ -517,6 +517,7 @@ public class ZZUIManager : MonoBehaviour
|
||||
SplitData(TempNPC);
|
||||
for(int i=0;i<NPCdian.Count;i++)
|
||||
{
|
||||
NPCController.instance.INITNPCMOVE(NPCdian[i]);
|
||||
Debug.LogError(NPCdian[i]);
|
||||
}
|
||||
DiaLogBox.SetActive(false);
|
||||
|
@ -21,11 +21,22 @@ public class NPCController : MonoBehaviour
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
public void INITNPCMOVE(Vector3 pos)
|
||||
{
|
||||
foreach (var npcDict in npcsList)
|
||||
{
|
||||
foreach (var kvp in npcDict)
|
||||
{
|
||||
RecuseNpc npc = kvp.Key;
|
||||
npc.SetNpcDes(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void InitNPC(Vector3 v,NpcData npcData)
|
||||
{
|
||||
// 使用指定的世界坐标位置来实例化 NPC,而不是依赖 trans 位置
|
||||
GameObject go = GameObject.Instantiate(npc, v, Quaternion.identity); // 直接指定位置和旋转
|
||||
GameObject go = GameObject.Instantiate(npc, v, Quaternion.identity); // 直接指定位置和旋转c
|
||||
RecuseNpc recuseNpc = go.GetComponent<RecuseNpc>();
|
||||
recuseNpc.SetNPCInfo(npcData.UserId);//初始化npcid
|
||||
Debug.Log(npcData.UserId);
|
||||
|
Loading…
Reference in New Issue
Block a user