// Use this for initialization void Start() { //게임씬으로 시작시 리소스로딩이 안되어 있기 때문에, // 작업편의성을 위해 직접 동기로 불러오는 처리를 넣는다. if (false == Single.resource.IsCompleteLoad()) { Single.resource.Load_Sync(); } Table.File_NodeInfo table = Single.resource._nodeInfo; foreach (Table.NodeInfo nodeFrom in table._data) { _graph.AddNode(new NavGraphNode(nodeFrom.nodeNum, _town.position + nodeFrom.nodePos)); } foreach (Table.NodeInfo nodeFrom in table._data) { foreach (int edgeTo in nodeFrom.edgeList) { _graph.AddEdge(new GraphEdge(nodeFrom.nodeNum, edgeTo)); } } //Debug.DrawLine(Vector3.zero, new Vector3(1, 1, 0), Color.red); //Debug.Assert (false, "sdfsdfsdfsdf assert"); }
void Update() { if (true == _saveXML) { Table.File_NodeInfo table = Single.resource._nodeInfo; List <Table.NodeInfo> saveList = new List <Table.NodeInfo>(); NodeInfo_MonoBehaviour[] monoList = _town.GetComponentsInChildren <NodeInfo_MonoBehaviour>(false); foreach (NodeInfo_MonoBehaviour mono in monoList) { saveList.Add(new Table.NodeInfo(mono._nodeNumber, mono.transform.localPosition, mono._adjacencyEdgeList)); } table._data = saveList; table.SaveXML("Assets/StreamingAssets/" + "townNode.xml", table._data); //--------------- _saveXML = false; } if (true == _loadXML) { Table.File_NodeInfo table = Single.resource._nodeInfo; NodeInfo_MonoBehaviour[] monoList = _town.GetComponentsInChildren <NodeInfo_MonoBehaviour>(false); foreach (NodeInfo_MonoBehaviour mono in monoList) { GameObject.Destroy(mono.gameObject); } foreach (Table.NodeInfo info in table._data) { this.AddNodePrefab(info); } //--------------- _loadXML = false; } if (true == _updateNode) { NodeInfo_MonoBehaviour[] monoList = _town.GetComponentsInChildren <NodeInfo_MonoBehaviour>(false); foreach (NodeInfo_MonoBehaviour mono in monoList) { //mono.UpdateEdgeList(); mono._isUpdateValue = true; } _updateNode = false; } }