public void ProcessLevel(Level level, LevelTracker tracker) { _levelTracker = tracker; for (int x = 0; x < level.Walls.GetLength(0); x++) { for (int y = 0; y < level.Walls.GetLength(1); y++) { AddEntity(CreateEntity(EntityType.Floor, new Vector2Ref(x * level.TileWidth, y * level.TileHeight))); #region Walls if (level.Walls[x, y]) { AddEntity(CreateEntity(EntityType.Wall, new Vector2Ref(x * level.TileWidth, y * level.TileHeight))); } #endregion #region MapData EntityType mapData = level.SpawnData[x, y]; if (mapData != EntityType.Nothing) { AddEntity(CreateEntity(mapData, new Vector2Ref(x * level.TileWidth + level.TileWidth / 2, y * level.TileHeight + level.TileHeight / 2))); } #endregion } } RegisterAllEntities(); RegisterLevel(level); }
private void LoadLevel() { _gameTracker.Runs++; _levelGenerator.TotalEnemySpawnBudget = _levelGenerator.TotalEnemySpawnBudget + 50 * _gameTracker.Runs; _currentLevel = _levelGenerator.GenerateLevel(); _currentLevelTracker = new LevelTracker(); _ecs.PurgeForNextLevel(); _ecs.ProcessLevel(_currentLevel, _currentLevelTracker); _hero = _ecs.GetHero(); }