/// <summary> /// パスを指定してウェーブエネミー情報を読み込み /// </summary> public void ReadWaveInfo(string filePath) { waveInfoList = new List <List <WaveEnemyInfo> >(); if (!File.Exists(filePath)) { return; } //読み込み using (TextReader r = FuncBox.GetTextReader(filePath)) { string line = ""; string[] split; List <WaveEnemyInfo> enemyInfoList = new List <WaveEnemyInfo>(); //ファイル走査 while ((line = r.ReadLine()) != null) { split = line.Split(','); if (split[0] == "<Wave>") { enemyInfoList = new List <WaveEnemyInfo>(); waveInfoList.Add(enemyInfoList); } else { Debug.Log(split[0]); enemyInfoList.Add(WaveEnemyInfo.ReadString(split)); } } } }
public static WaveEnemyInfo ReadString(string[] split) { WaveEnemyInfo w = new WaveEnemyInfo(); w.shipDataName = split[0]; w.type = split[1]; //ドロップアイテム string[] dropSplit = split[2].Split('-'); w.dropItemMin = int.Parse(dropSplit[0]); w.dropItemMax = int.Parse(dropSplit[1]); w.strongLebel = int.Parse(split[3]); w.hp = int.Parse(split[4]); //座標 string[] posSplit = split[5].Split('_'); w.pos.x = float.Parse(posSplit[0]); w.pos.y = float.Parse(posSplit[1]); return(w); }