public void AddNpc(DataRow data, MapNpc node) { //int id = int.Parse(data["id"].ToString()); //MapNpc node = new MapNpc(id); node.type = int.Parse(data["type"].ToString()); if (node.type == 1) { node.ai = 1; } else { node.ai = 4; } node.npcName = data["name"].ToString(); node.modelId = data["modelId"].ToString(); editMapNpc(node, OPERATE_ADD); Vector3 npcPos = new Vector3(0, 0, 0); GameObject obj = npcHelper.LoadNpc(node, npcPos); EditorTool.CenterObj(obj); if (EditorData.terrainMan != null) { Vector3 pos = obj.transform.localPosition; pos.y = EditorData.terrainMan.GetHeight(pos.x, pos.z); obj.transform.localPosition = pos; IntPoint pt = PathUtilEdit.Real2Logic(pos); node.x = pt.x; node.y = pt.y; //EditorTool.LookObj(obj); } }
public void AddEffectPoint(MapEffectPoint node) { int id = 1; while (effectPointCollection.ContainsKey(id)) { id++; } node.id = id; addMapEffectPoint(node, OPERATE_ADD); Vector3 npcPos = new Vector3(0, 0, 0); GameObject obj = npcHelper.AddEffectPoint(node, npcPos); if (obj == null) { return; } EditorTool.CenterObj(obj); if (EditorData.terrainMan != null) { Vector3 pos = obj.transform.localPosition; pos.y = EditorData.terrainMan.GetHeight(pos.x, pos.z); obj.transform.localPosition = pos; IntPoint pt = PathUtilEdit.Real2Logic(pos); node.x = pt.x; node.y = pt.y; //EditorTool.LookObj(obj); } node.target = obj; }
public void AddZone(MapZone node) { editWholeZone(node, OPERATE_ADD); //Vector3 posPt = new Vector3(node.x, EditorData.terrainMan.GetHeight(node.x, node.y), node.y); //Vector3 npcPos = posPt; Vector3 npcPos = new Vector3(0, 0, 0); GameObject obj = npcHelper.AddMapZone(node, npcPos); if (obj == null) { return; } EditorTool.CenterObj(obj); if (EditorData.terrainMan != null) { Vector3 pos = obj.transform.localPosition; pos.y = EditorData.terrainMan.GetHeight(pos.x, pos.z); obj.transform.localPosition = pos; IntPoint pt = PathUtilEdit.Real2Logic(pos); node.x = pt.x; node.y = pt.y; //EditorTool.LookObj(obj); } node.target = obj; }
public void addLine(MapLine node) { addMapLine(node, OPERATE_ADD); Vector3 npcPos = new Vector3(0, 0, 0); GameObject obj = npcHelper.AddLine(node); if (obj == null) { return; } //EditorTool.CenterObj(obj); for (int i = 0; i < node.linepts.Count; i++) { if (EditorData.terrainMan != null) { Transform trans = obj.transform.FindChild("points" + (i + 1)); if (trans == null) { continue; } EditorTool.CenterObj(trans.gameObject); Vector3 pos = trans.localPosition; pos.y = EditorData.terrainMan.GetHeight(pos.x, pos.z); obj.transform.localPosition = pos; IntPoint pt = PathUtilEdit.Real2Logic(pos); MapLinePoint tempPos = node.linepts[i]; //node.linepts[i].x= pt.x; //node.linepts[i].y = pt.y; //EditorTool.LookObj(obj); } } node.target = obj; }