public void LoadContent(int levelValue) { _levelValue = levelValue; _currentWave = -1; _waveTimer = 5000; // Load the enemies into the unit list List <Tuple <string, int> > list = LoadFromFile(); foreach (Tuple <string, int> val in list) { string type = val.Item1; int num = val.Item2; switch (type) { case "---": _waves.Add(new Wave(++_currentWave, _numLanes, FIELD_SIZE, FIELD_ORIGIN)); break; case "WeakMelee": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateWeakMelee()); } break; case "Trojan": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateMediumMelee()); } break; case "HeavyMelee": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateStrongMelee()); } break; case "WeakRanged": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateWeakRanged()); } break; case "MediumRanged": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateMediumRanged()); } break; case "StrongRanged": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateStrongRanged()); } break; case "WeakAerialMelee": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateWeakAerialMelee()); } break; case "WeakAerialRanged": for (int i = 0; i < num; i++) { _waves[_currentWave].AddUnit(UnitFactory.CreateWeakAerialRanged()); } break; default: throw new ArgumentException("check spelling of an enemy type"); } } _currentWave = -1; foreach (Wave w in _waves) { w.LoadContent(); } }