Beispiel #1
0
    static void UpdateEnviroment()
    {
        string content = File.ReadAllText(Application.dataPath + "/../../../Config/Tables/Npc.csv");

        NpcData.ParseData(content, "Npc.csv");
        content = File.ReadAllText(Application.dataPath + "/../../../Config/Tables/EntityAssets.csv");
        EntityAssetsData.ParseData(content, "EntityAssets.csv");
        Dictionary <int, NpcData> allNpc = NpcData.GetData();

        foreach (NpcData nData in allNpc.Values)
        {
            //if (nData.sceneID_ == int.Parse(scene_.ID))
            //{
            //    for (int i = 0; i < scene_.funcPointList.Count; ++i)
            //    {
            //        if (nData.pointID_ == int.Parse(((FunctionalPoint)scene_.funcPointList[i]).ID))
            //        {
            //            string assName = EntityAssetsData.GetData(NpcData.GetData(nData.id_).assetsID_).assetsName_;
            //            string path = "Assets/ResData/Role/Prefabs/" + assName + ".prefab";
            //            GameObject npc = Resources.LoadAssetAtPath(path, typeof(GameObject)) as GameObject;
            //            npc = (GameObject)GameObject.Instantiate(npc) as GameObject;
            //            npc.name = "NPC_" + nData.id_.ToString();
            //            npc.transform.position = new Vector3(((FunctionalPoint)scene_.funcPointList[i]).X, ((FunctionalPoint)scene_.funcPointList[i]).Y, ((FunctionalPoint)scene_.funcPointList[i]).Z);
            //            npc.transform.rotation = new Quaternion(((FunctionalPoint)scene_.funcPointList[i]).RX, ((FunctionalPoint)scene_.funcPointList[i]).RY, ((FunctionalPoint)scene_.funcPointList[i]).RZ, ((FunctionalPoint)scene_.funcPointList[i]).RW);
            //            Transform parent = funcObjList_[i].transform.parent;
            //            DestroyImmediate(funcObjList_[i]);
            //            funcObjList_[i] = npc;
            //            npc.transform.parent = parent;
            //        }
            //    }
            //}
        }
    }