public MapTranslator(string path) { StreamReader sr = new StreamReader(path); int EnemyCount = 0; int change; while (!sr.EndOfStream) { char[] nextline = sr.ReadLine().ToCharArray(); change = nextline[0]; EnemyCount += change; Enemies += change; switch (change) { case 1: Spawn1.Add(EnemyCount); break; case 2: Spawn2.Add(EnemyCount); break; case 3: Spawn3.Add(EnemyCount); break; case 4: Spawn4.Add(EnemyCount); break; case 5: Spawn5.Add(EnemyCount); break; default: break; } } }
// Use this for initialization void Start() { tr2 = GameObject.FindObjectOfType <Spawn1>(); tr1 = GameObject.FindObjectOfType <Spawn>(); }