Phase ParseXML() { Debug.Log("parseXML"); Phase phase = new Phase(); // xml 지정 string m_strName = string.Format("xml/{0}", phases[phaseNum]); XmlDocument document = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load(m_strName, typeof(TextAsset)); XmlDocument xmldoc = new XmlDocument(); document.LoadXml(textAsset.text); // phase에 step insert int itemCount = document.LastChild.ChildNodes.Count; string name = string.Empty; for (int i = 0; i < document.LastChild.ChildNodes.Count; ++i) { if (name != document.LastChild.ChildNodes[i].Name) { phase.AddStep(new Step()); name = document.LastChild.ChildNodes[i].Name; } } // step에 spawn insert int index = -1; for (int i = 0; i < document.LastChild.ChildNodes.Count; ++i) { //step load XmlNode step = document.LastChild.ChildNodes[i]; if (Int32.Parse(step.ChildNodes[0].InnerText) == 0) { continue; } bool isStartOfStep = Int32.Parse(step.ChildNodes[0].InnerText) == 1; if (isStartOfStep) { index++; } SpawnInfo spawn = new SpawnInfo(); spawn.enemyType = (Common.ENEMY_TYPE)(Int32.Parse(step.ChildNodes[1].InnerText)); spawn.spawnPos = Int32.Parse(step.ChildNodes[2].InnerText); spawn.destinationPos = Int32.Parse(step.ChildNodes[3].InnerText); spawn.spawnCoolTime = float.Parse(step.ChildNodes[4].InnerText); spawn.enemyMove = (Common.ENEMY_MOVE_TYPE)(Int32.Parse(step.ChildNodes[5].InnerText)); spawn.aimTime = float.Parse(step.ChildNodes[6].InnerText); spawn.item = (Common.ITEM_TYPE)(Int32.Parse(step.ChildNodes[7].InnerText)); //step add phase.stepList[index].AddInfo(spawn); } //phase add return(phase); }